mihnita / ansi-econsole

Eclipse plugin that understands ANSI escape sequences to color the Eclipse console output.
http://www.mihai-nita.net/java/
Other
90 stars 25 forks source link

Basic support for other non-SGR escape sequences #12

Closed bendiscz closed 9 years ago

bendiscz commented 9 years ago

I am using Eclipse-CDT and I want to use GCC with "-fdiagnostics-color" to get colored compilation output. The problem is that GCC for some reason emits "erase" escape sequences "^[K" that are not detected by this plugin and appear in the console output. So I extended this plugin to parse all escape sequences starting with "^[" and strip the sequences that are not understood so they do not clutter console output. The regular expression used to find all CSI escape sequences matches everyting from "\u001b[" to the first character from ASCII range 64–126 as described in http://en.wikipedia.org/wiki/ANSI_escape_code#Sequence_elements.

mihnita commented 9 years ago

Thank you, I like the idea.

But I will wait until the week-end to take a closer look. It looks like the regexp would "eat" too much (for instance "[mNothing" would all match, although it should stop at m)

And I would also like to make it optional. Active by default, but maybe some people would not want it. Have to thing about it, see if I can think of an use case to keep these sequences. Maybe there is no need for option, just do it, the way you did. Thanks again (something will be in soon, promise).

bendiscz commented 9 years ago

Hi,

Thanks for the reply! The regexp will stop on the first character from the range 64-126, so only "[m" would be matched from "[mNothing". You can easily test it yourself.

However, making it optional sounds like a good idea!

paulvi commented 9 years ago

Nice to see refresh touch.

Please don't forget to update README or wiki