winpty
winpty copied to clipboard
Is 256 color supported?
Downstream issue: https://github.com/Microsoft/vscode/issues/24620
This was done through VS Code Insiders which runs [email protected]/[email protected].
Running the following through Cygwin/Git Bash:
echo -e '\x1b[48;5;100mfoo\x1b[0m'
Results in:
Here is what's being sent back from node-pty:
Expected (run under macOS/bash):

It's definitely not supported currently. At the moment, I don't know how winpty could add support, because AFAIK there's no API to read 256-color info. winpty reads cell contents using ReadConsoleOutput
, which returns each cell's contents in a CHAR_INFO
struct, which has a 16-bit field for a Unicode codepoint and another 16-bit field for text attributes. The 16-bit attributes field uses 4 bits each for foreground and background color, then another 7 bits for LVB attributes.
In principle, the winpty project could include a wrapper program like wslbridge (or ConEmu's Cygwin connector?) that creates a Cygwin/MSYS2/WSL pty, connects to the winpty agent over a TCP socket, then marshals VT/100 I/O directly to the winpty client without going through the console.
Pros:
- Faster and quicker I/O, probably.
- No line wrapping quirks
- 256-color support
- Full UTF-8 support
Cons:
- It would only work for Cygwin/MSYS2/WSL programs
- People have to know to run the "connector" program
- The Cygwin/MSYS2 connectors would link against Cygwin's DLL, and I'm not sure the Cygwin DLL's ABI is stable. ConEmu is doing it, though, so maybe it's good enough.
- More complexity. I'm not sure how motivated I am to implement it.
Regarding the output passthrough, this other winpty request was related: https://github.com/rprichard/winpty/issues/89.
Has there been any further discussion behind the scenes on this issue? Microsoft recently opened up a Console repository where issues may be opened for conhost.exe and the console API. Perhaps opening an issue here might help get things moving again (if they're not already).
https://github.com/microsoft/console
Is anyone on this bug ?
This creates all shorts of color problems.