Closed tyan0 closed 3 years ago
@tyan0 Thx for the detailed analysis. I don't have a Windows 7 at hand, so I haven't been able to test it, but I slightly modified your patch. Let me know if this works for you asap, as I'd like to get a new release out soon.
Thanks for fixing the problem. I pulled the git head and have confirmed that the problem disappeared in Windows 7.
Sorry, my test might not be enough.
I have a question. https://github.com/fusesource/jansi/blob/fc2f4b4c3f19acc6e7ce6f17257a1e1aaa0260d4/src/main/java/org/fusesource/jansi/AnsiConsole.java#L410 Shouldn't this be as follows?
boolean resetAtUninstall = type != AnsiType.Emulation && !getBoolean(JANSI_NORESET);
Current code seems to have no effect for Win7 console.
Overview
In cygwin console on Windows7, output of jansi v2.1.1 is corrupted. This also happen with current git head of jansi.
Description
Output of Maven, whose jansi library is replaced with jansi v2.1.1, is corrupted in cygwin console (command prompt) on Windows7.
This does not occur in the systems which support
ENABLE_VIRTUAL_TERMINAL_PROCESSING
. Also works without the problem in mintty.The Cause
Even in cygwin, ANSI escape sequence is not supported in console (command prompt) if the process is not a cygwin process. If console supports ENABLE_VIRTUAL_TERMINAL_PROCESSING, ANSI escape sequences can be used with this flag set. Windows7 does not have this flag, therefore, AnsiType.Emulation should be selected in AnsiConsole.java. However, current code decides to use ANSI escape sequences for cygwin console on Windows7.
Moreover, "ESC[0m" is sent unconditionally in AnsiOutputStream.java. This also causes garbled output in cygwin console on Windows7.
Patch for this issue