ANSI Escape in Console

Add this URL to your Eclipse Installation to reach this solution's update site.

Mars (4.5)
Luna (4.4)
Kepler (4.3)
Juno (4.2, 3.8)
Previous to Juno (<=4.1)
Neon (4.6)
Oxygen (4.7)
Photon (4.8)
2018-09 (4.9)


Learn more...

Details Group Tabs

Monday, September 24, 2018 - 06:50
asolovjevqet's picture

Does not work properly with multiline coloring. I have about 30 lines of output from c++. Let's say the line 10 is the sequence of red color. Then 3 lines that should be red and the code for restoring the default color in the end of the third line. Other lines should have default color. With such output I've got red in different places while scrolling the eclipse's terminal. Sometimes red are first 10 lines, sometimes last part of the text. May be the plugin works only if setting and restoring sequences are localized in the same line?

Oxygen.3a Release (4.7.3a)

mnita's picture

Unfortiunately, a known problem, and one that I don't really think I can solve.
https://github.com/mihnita/ansi-econsole/issues/3

It is a limitation in the Eclipse console itself: my plugin only get a line at the time, and when the console buffer gets full the top lines are dropped, the line numbers change, and all context is lost. So when coloring the current line there is no way to know what was set X lines above :-(

I am also anoyed by this bug, I have some idea. But is very hacky, but it might also mess up the performance.

Sorry,
Mihai

 

sasadi's picture

Could you notify us whenever you have a new release of "ANSI Escape in Console" for Mac OS High Sierra?

I am using Eclipse C++ in Mac OS High Sierra. It seems this pluging removed a part of messages in the console. 

s_asadi83[at]yahoo.con

rcarrm45's picture

Spring Boot applications that log using ANSI color codes won't display on the eclipse console. If the text is copied from the console to another app (say Terminal), you can read all the text. It is as though  the text is rendered in the same color as the background color of the conole.

mnita's picture

This seems to be a system / SWT problem.
Bug opened, https://bugs.eclipse.org/bugs/show_bug.cgi?id=525383

aamfistomos's picture

Still occurs with Mac OS High Sierra official release...

mnita's picture

This seems to be a system / SWT problem.
Bug opened, https://bugs.eclipse.org/bugs/show_bug.cgi?id=525383

hsengupta's picture

Cannot Install. Facing error
"Unable to read repository at http-www mihai-nita net -eclipse-content xml
peer not authenticated"

Can anyone look into this Please..

vmisingnamekvr's picture

Hi, is it possible to turn on also ANSI-coloring during build in build console for ROS groovy projects?
For some reason it is not ANSI-colored here (Eclipse 4.4)

mnita's picture

Sorry, I don't have an Ubuntu installed (just Win and Fedora).
I have found a VM, and I can try that.

But a quick look at the sources finds this "suspicious" line in catkin_make and catkin_prepare_release:

# force --no-color if stdout is non-interactive
if not sys.stdout.isatty():
    args.no_color = True

Since Eclipse needs to capture its output, it starts the build with the stdio and stderr redirected.
And that makes sys.stdout.isatty() return False (because the Eclipse console is not really a terminal).

It looks like there is no way to get around this without code changes.
But you can just comment these two lines and it should work.

If you are on Windows, the terminal_color.py also needs some fixing, because it assumes that Windows cannot support ANSI escapes (not true):

if os.name in ['nt']:
    disable_ANSI_colors()

The way I would fix ROS "for real" would be by adding a --force-color flag
(or do what most posix apps do: --color=never|always|auto and also honor an environment variable)

Anyway, if commenting the "if not sys.stdout.isatty():" does not work, please let me know, and I will go ahead and try top setup a working ROS environment.

Thank you,
Mihai

mnita's picture

I don't know, I have never played with ROS. Let me give it a try, and will get back to you.
Thank you!
Mihai

pverest's picture

Just look at picture and try to recall all those ANSI codes...