ansicon icon indicating copy to clipboard operation
ansicon copied to clipboard

Modularize and abstract the interpreter in order to make it more reusable

Open KOLANICH opened this issue 6 years ago • 4 comments

KOLANICH avatar Jan 23 '19 21:01 KOLANICH

Reusable for what? Including the source files directly into a project, to remove DLL dependency? I've thought about a "lite" version (basically just SGR), which could be used that way. Not sure it's really worth it, though.

adoxa avatar Jan 24 '19 06:01 adoxa

Reusable for what?

I wanna make an plugin for Notepad++ using some ANSI escape sequences interpreter, but the plugin has nothing to do with drawing, instead it should use the interpreter just to compute styles of chunks of text and pass the styles to Scintilla, and Scintilla will draw them itself. There are some flaws with Scintilla (count of styles is limited), but for low count of styles it should work.

KOLANICH avatar Jan 24 '19 07:01 KOLANICH

Looks like something that's been requested a few times, but not actually written. A bit surprising. I think you'd be better off starting from scratch. Parsing is simple: look for characters \x1B[; parse numbers separated by semicolons (eight should be sufficient); read next character. If that character is m interpret the numbers as SGR and convert to Scintilla style; otherwise leave it be. That's probably all you need.

adoxa avatar Jan 24 '19 08:01 adoxa

I think you'd be better off starting from scratch.

I hoped I wouldn't have to ;)

KOLANICH avatar Jan 24 '19 20:01 KOLANICH