Change a color only of a part of the line displayed on a console?

Hi,

I would like in my plugin to change a color (and a background) only of a part of the line displayed on a standard console in Idea (to render an ANSI escape characters as color characters). I haven't seen it anywhere and TextAttributes class seems to be available only for a line of the text. Is it possible with a console component in Idea?

Marcin

5 comments

Hi Marcin,

You can have a look at this plugin - it already does coloring stuff and its open source.

Denis

0

Hey, I just looked at it yesterday.

You can change color of only a part of the text, but you cannot change the input, so you will have colored but not readable text.
It could be possible to change the input and color its parts in InputFilter, but Denis would have to change the API as I wrote here http://youtrack.jetbrains.com/issue/IDEA-95644

btw there is an implementation for eclipse ansi console on github.

0

Thanks for your replies.

I know Grep Plugin and its source code, but it only highlights the whole lines. In fact I wanted to add an Ansi escape characters support to Grep Plugin. I have seen IDEA-95644, but not the latest comments (from today). As the last resort I planned to just cut escape characters (to make the output cleaner - coloring provided by Grep Console is usually enough), but in case it would be possible to colorize separate characters and meo has it planned already I will wait to see the effect.

Marcin

0

It highlights whole lines only because I am too lazy to implement group highlighting as is in eclipse counterpart  :^O  http://marian.schedenig.name/2012/08/11/grep-console-how-to-3-capture-groups/
So technically you could highlight single words, but how would you then cut off the ansi escape characters? For that reason I will wait for the new InputFilter.

0

Please sign in to leave a comment.