ansicon
ansicon copied to clipboard
Modularize and abstract the interpreter in order to make it more reusable
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.
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.
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.
I think you'd be better off starting from scratch.
I hoped I wouldn't have to ;)