-
Notifications
You must be signed in to change notification settings - Fork 166
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
Win10 New Console: Enable ENABLE_VIRTUAL_TERMINAL_PROCESSING by default (or with a flag) #92
Comments
MS's built in processing is kind of suuuuuuper broken atm. I trust your escape processing over theirs any time. The other problem is that you would need to somehow push the escapes to the terminfo databases, and MS's escape sequence interpretation is not yet stable. |
The issue is what happens when a console program uses
In other words, the |
Alright, just as long as you are aware that MS's escape coverage of xterm esc sequences is buggy and incomplete. I know this from extensive use of bash.exe in the default console. It won't do anything unless you export a different TERM (xterm instead of cygwin). |
I'm guessing this is not an environment variable but something that needs to be defined in the C source code. I had ghci giving back weird characters because I ported it from my linux one which used escape codes. Would be interested to see what it looks like with the option switched on. |
@CMCDragonkai Yep, it's something you define in the sourcecode that needs to be set on the I/O handles to the console. |
Most of the programs I've seen that try to turn
All four set the VT mode flag when they started. CMD seemed to do something extra -- when it spawned a child process, it reset the console mode to the value it had on CMD start. Once the child exited, CMD set the VT mode flag again. CMD didn't restore the original mode when it exited. I also ran PowerShell, then a Cygwin 2.7.0 bash subshell under that, and finally another PowerShell subshell under the two. When Cygwin bash started, and when I exited the nested PowerShell, Cygwin turned the VT mode flag off. The topmost PowerShell instance did not turn the VT flag back on when I exited Cygwin bash. FWIW, I'm more inclined now to have winpty turn the flag on. |
Actually, since Cygwin turns the VT flag off, I'm more inclined to have winpty do nothing by default. Maybe there could be an optional flag, though. |
This sounds like PowerShell/PowerShell#1177 which was fixed in PowerShell 6.0 Alpha 15 FWIW. |
@dragonwolf83 Thanks for the link. It looks like PowerShell is going to behave more like the CMD behavior I described above, where the shell cleans up after programs that change the VT flag. The commit message also restates the idea that applications need to opt-in to VT100 support:
|
Windows 10's console recently began interpreting escapes, but only with
ENABLE_VIRTUAL_TERMINAL_PROCESSING
, which is off by default. Maybe winpty should turn it on for its underlying console. Or, at the least, there could be a command-line flag to turn it on.My use case was running Clang under Ninja under winpty. I configured Clang to output ANSI escapes, and it seems that Ninja wrote the escapes to the console (e.g. with WriteFile) rather than interpret them. If
ENABLE_VIRTUAL_TERMINAL_PROCESSING
were enabled, I think the escapes would still work.The text was updated successfully, but these errors were encountered: