gui-cs / Terminal.Gui

Cross Platform Terminal UI toolkit for .NET
MIT License
9.61k stars 687 forks source link

`WindowsDriver` is broken on `conhost` #2822

Open tig opened 1 year ago

tig commented 1 year ago
image

RGB works in conhost, so I'm not quite sure why this is not working:

image

In v2 true color is now the default. To fix this we need to either:

1) Figure out why emitting the ANSI ESC sequences is not working on conhost 2) Add code to test for 24 bit color in the terminal using the method described here: https://github.com/termstandard/colors 3) FIgure out how to reliably detect we're not in Windows Terminal and switch to Force16Color = true.

Note that testing for the WT_SESSION is NOT reliable as I thought.

tig commented 1 year ago

NetDriver further shows that true color does work in conhost.

image
BDisp commented 1 year ago

In v2 true color is now the default. To fix this we need to either:

1. Figure out why emitting the ANSI ESC sequences is not working on conhost

Because we are using win32 API to manage the keyboard and mouse and is better to keep as it is because ANSI ESC is very slower on Windows. Only Windows Terminal can handles it more faster.

2. Add code to test for 24 bit color in the terminal using the method described here: https://github.com/termstandard/colors

It's more based on ANSI ESC and most Windows console doesn't support it without Win32 API.

3. FIgure out how to reliably detect we're not in Windows Terminal and switch to `Force16Color = true`.

Note that testing for the WT_SESSION is NOT reliable as I thought.

Why? Do you think we should use the another alternative I presented before?

@tig for WindowsDriver we have to use Win32 API to manage with true color. I think there is some library that could manage it, but we must study first :-) For the Windows Terminal if it not work with Win32 API, then we use ANSI ESC for that.

BDisp commented 1 year ago

About ConEmu can you use the mouse? Only the click works. It seems it doesn't forward the mouse events for the app and I can't discover any configuration that can change that.

tig commented 1 year ago

Mouse has never worked right on conemu. I gave up trying to figure it out.

tig commented 1 year ago

Virtual Terminal Sequences, the new windows API that supports true color is really just a fancy name for ansi esc sequences.

BDisp commented 1 year ago

Virtual Terminal Sequences, the new windows API that supports true color is really just a fancy name for ansi esc sequences.

I know that, but did you already realize that was what I implemented in the NetDriver to Windows have support for ansi esc sequences, but is very slow on Windows with the conhost, mainly with mouse events.