mihnita / ansi-econsole

Eclipse plugin that understands ANSI escape sequences to color the Eclipse console output.

Home Page:http://www.mihai-nita.net/java/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Escape code ignore sometimes

ydaveluy opened this issue · comments

Dear Mihai,

I noticed that sometime some escape codes are not processed by the console.

To reproduce you can execute allTest256() 100 times in a for loop : https://github.com/mihnita/ansi-econsole/blob/28e93303e52dc3b5649f8a8af352c95a4363d1f5/AnsiConTest/src/AnsiConTest.java#L146.

After investigation it seems that it comes from https://github.com/mihnita/ansi-econsole/blob/28e93303e52dc3b5649f8a8af352c95a4363d1f5/AnsiConsole/src/mnita/ansiconsole/participants/AnsiConsoleStyleListener.java#L209
When an incomplete escape code is at the end of the text argument, the position is not detected.
I think that incomplete escape sequences at end of text should be saved and prepended to the beginning of text on next call.

Sorry, can't reproduce.

But there are quite a few settings that can influence this.
Most under Preferences -- Run/Debug -- Console

First is probably Console buffer size
For example mine is 1000000, default is 80000
I tried with both value, I can't see any problem.

Things like "Interpret ASCII control characters" and "Interpret Carriage Return (\n) as control character" might also count.

Even the OS and theme color might matter
(for example the Windows Dark is a lot slower than any other combination of OS and theme)

So, can you please add some info about your current OS and configuration?

Thank you,
M.

I think that the OS and configuration doesn't matter.
Here is a test case to reproduce the issue:
`
static void testIncompleEscapeSequence()
{
System.out.print("normal text\u001b");
System.out.flush();

try {
Thread.sleep(2000l);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("[0;31m red text\u001b[m normal text");

}
`

Reproduced...

And spent some time digging into it.
I know where the problem is, and thinking of a low-impact way to fix it.
But I am a bit busy (until about half of August).
It will be in the back of my mind, of I get some time (or I have some sudden idea :-)
I don't want a big change, as this should be a pretty rare occurrence, and even when it happens, it is not critical.

Thank you!
Mihai