Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape code ignore sometimes #80

Open
ydaveluy opened this issue Jun 13, 2022 · 3 comments
Open

Escape code ignore sometimes #80

ydaveluy opened this issue Jun 13, 2022 · 3 comments
Assignees
Labels
P2 Priority 2. Bad, but there is an easy (and one time) workaround.

Comments

@ydaveluy
Copy link

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.

@mihnita
Copy link
Owner

mihnita commented Jun 15, 2022

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.

@ydaveluy
Copy link
Author

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");

}
`

@mihnita mihnita self-assigned this Jun 27, 2022
@mihnita mihnita added the P2 Priority 2. Bad, but there is an easy (and one time) workaround. label Jun 27, 2022
@mihnita
Copy link
Owner

mihnita commented Jun 27, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Priority 2. Bad, but there is an easy (and one time) workaround.
Projects
None yet
Development

No branches or pull requests

2 participants