-
Notifications
You must be signed in to change notification settings - Fork 835
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
Pass ANSI Escape Sequences up to the Console #406
Comments
Desperately needed. I mean apple fanboys always try to show off with fancy iterm2, while I hide in the corner living in an 8-bit world. |
This not only breaks (potential) 256 color support, but also causes serious issues with basic ANSI functionality (arrow keys among other things - which have been worked around in ConEmu). Simple reproducer for ANSI reverse: printf "Normal\n\x1b[7mReverse\x1b[0m\nNormal\n" The "reverse" sequence is silently swallowed and interpreted locally by the console emulation layer before it can reach ConEmu, so in plain bash.exe it would display "Reverse" with fg/bg swapped, but in ConEmu fg and bg are not swapped. If you want a more complex reproducer, fire up |
The bash.exe uses SetConsoleMode setted ENABLE_VIRTUAL_TERMINAL_PROCESSING (MSDN). And we can get original ANSI sequences after disable it. |
We can't get original ANSI. They are written directly into conhost memory. That means one console line would have few chars instead of full line of data. |
I am also looking forward this. ref: #345 (comment) @ysc3839 how do I do this? Are you sure it's possible? |
@antitoxic I hooked SetConsoleMode then clear the ENABLE_VIRTUAL_TERMINAL_PROCESSING bit. But ConEmu can't process them. |
@Maximus5 We should push for the official PTY API, instead of hooking. |
There would be no new API. Example of the answer: #345 (comment) |
@Maximus5 It’s the API for implementing an alternative terminal, instead of an API for writing text in 24 bit colors (or something like that). |
cf. #1117 |
I agree with @be5invis. Hooking is bad. If you want to hook the console to make your own, then you can go ahead and parse the VT sequences yourself too :p |
Unless Microsoft would provide official way to implement pty interface, the hooking is only possible technique. |
a) you'd have to implement a VT parser, and have your own mechanism for determining if it's enabled or not. No, technically there's no way to determine if the output is a sequence or not, but that's because most terminals just assume that it is. b) That they do. you'd have to assume that the conhost buffer is garbage, and manage it all on your own. Again, we're not supporting hooking, and in the most general and vague way possible, we'll have some things to announce in the future that you'll all be very happy about, but we've got a lot to do before that |
a) VT parser was implemented in ConEmu years ago. But any application may write to conhost buffer via WriteConsoleOutput. And these sequences are not valid VT sequences. Without hooking or the imaginary pty API ConEmu can't distinct them. b) I can't. Due to a). And disability to understand are sequences were enabled or disabled. Without hooking I can't restrict bash to turn on 0x200 flag, and even if it would be dropped by ConEmu hooks, there would be absolutely no guarantee that some other application, attached to this console, is not trying to use native WinAPI instead of VT. So, when it really would be possible, I'll be happy to go of hooking, but till than there is no other way. If you are interested in, hooking is used for many other things in ConEmu. For example, GetConsoleWindow have to return ConEmu window instead of conhost, otherwise applications would work improperly when they use console HWND. |
@zadjii-msft So, to avoid hooking, we NEED a PTY API which makes us able to implement an alternative console host, and things like |
sadly, no xterm-256 colors due to conemu/windows bickering Maximus5/ConEmu#227 microsoft/WSL#345 (comment) microsoft/WSL#406 (comment)
Was going to submit a bug but it would have been a dupe of this one I think. I too see problems in aptitude as of Windows build 16237. I'd include a screenshot, but it's so easy to repro it would add nothing. If the bug isn't obvious as soon as you run aptitude, try navigating (down arrow or 'j' or whatever). Edit for correction: the problem I'm having may be slightly different. Text is ending up in the wrong locations so that in the aptitude example (the only program I've seen so far with the behavior) the "New Packages" heading is drawn on line 3, the cursor is on line 4, and when I navigate the headings are re-drawn one line down as they are highlighted and de-highlighted. Looks like a cursor position surprise of some sort. Also this happens in and out of GNU Screen. |
Thanks for the discussion. Closing this issue since:
If you have further asks/issues, please file new issues on our Console GitHub Repo. |
@bitcrazed What feature were you referring to? I'm still not able to create true colors using WSL 2 and Ubuntu 22.04. |
@samvv How have you tried so far? RGB color support has shipped in the console for like, 5 years now. If you're still having troubles, I'd recommend opening a new issue over on the Terminal repo. |
Thanks for the link. I'll be sure to check it tomorrow and open a new issue if it still is relevant. |
Currently ConEmu cannot process escape codes generated by applications running under the Windows Subsystem for Linux because they are processed before they can reach ConEmu (as stated in Maximus5/ConEmu#573). These sequences should be passed along to be handled at the console level.
The text was updated successfully, but these errors were encountered: