winpty icon indicating copy to clipboard operation
winpty copied to clipboard

Is 256 color supported?

Open Tyriar opened this issue 7 years ago • 5 comments

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:

image

Here is what's being sent back from node-pty:

image

Expected (run under macOS/bash):

screen shot 2017-04-21 at 10 00 11 am

Tyriar avatar Apr 21 '17 16:04 Tyriar

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.

rprichard avatar Apr 21 '17 20:04 rprichard

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.

rprichard avatar Apr 21 '17 21:04 rprichard

Regarding the output passthrough, this other winpty request was related: https://github.com/rprichard/winpty/issues/89.

rprichard avatar Apr 22 '17 01:04 rprichard

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

bgshacklett avatar Nov 20 '17 18:11 bgshacklett

Is anyone on this bug ?

This creates all shorts of color problems.

zzecool avatar Apr 25 '24 17:04 zzecool