Skip to content
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

Document how to enable truecolor on Windows #135

Closed
MichaelGoulding opened this issue Jun 29, 2021 · 2 comments
Closed

Document how to enable truecolor on Windows #135

MichaelGoulding opened this issue Jun 29, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@MichaelGoulding
Copy link

MichaelGoulding commented Jun 29, 2021

The code looks for the environment variable

COLORTERM

to enable true color.

Windows 10 has supported true color in the console for a while now, but FTXUI doesn't do the right thing without the environment variable set:

image

@ArthurSonzogni
Copy link
Owner

ArthurSonzogni commented Jul 1, 2021

I am sorry this terminal on Windows doesn't set the COLORTERM variable.

Maybe there is a standard ways in the terminal specification:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
to query directly the terminal support for colors.

The cost would be some communication with the terminal via stdin/stdout, before starting. This is a bit annoying, because user's might want to send/receive some data via this channel. I guess we need something user's can call when they need it.

Maybe

ftxui::QueryColorSupport()
ftxui::OverrideSupportedColor(color_mode)

that would query the terminal its supported colors and wait for a reply. It can store the results to:

Terminal::Color cached_supported_color;

https://github.com/ArthurSonzogni/FTXUI/blob/master/src/ftxui/screen/terminal.cpp#L50

It's quite hard for me test on Windows. Feel free to submit PR if you can, otherwise, I will try it, but this might take me some time.

@ArthurSonzogni ArthurSonzogni added the enhancement New feature or request label Jul 1, 2021
ArthurSonzogni added a commit that referenced this issue Jul 3, 2021
I finally got access to a computer using the Microsoft's Windows OS.
That's the opportunity to find and mitigate all the problems
encountered. This patch:

1. Introduce an option and a C++ definition to enable fallback for
   Microsoft's terminal emulators. This allows me to see/test the
   Microsoft output from Linux. This also allows Windows users to remove
   the fallback and target non Microsoft terminals if needed.

2. Microsoft's terminal do not provide a way to know if they support
   colors. As a fallback, assume true colors is supported.
   See issue:
   microsoft/terminal#1040
   This mitigates:
   #135

3. The "cmd" on Windows do not properly report its dimension. Powershell
   works correctly. As a fallback, use a 80x80 size instead of 0x0.

4. There are several dom elements and component displayed incorrectly,
   because the font used is missing several unicode glyph. Use
   alternatives or less detailled one as a fallback.
ArthurSonzogni added a commit that referenced this issue Jul 3, 2021
I finally got access to a computer using the Microsoft's Windows OS.
That's the opportunity to find and mitigate all the problems
encountered. This patch:

1. Introduce an option and a C++ definition to enable fallback for
   Microsoft's terminal emulators. This allows me to see/test the
   Microsoft output from Linux. This also allows Windows users to remove
   the fallback and target non Microsoft terminals if needed.

2. Microsoft's terminal do not provide a way to know if they support
   colors. As a fallback, assume true colors is supported.
   See issue:
   microsoft/terminal#1040
   This mitigates:
   #135

3. The "cmd" on Windows do not properly report its dimension. Powershell
   works correctly. As a fallback, use a 80x80 size instead of 0x0.

4. There are several dom elements and component displayed incorrectly,
   because the font used is missing several unicode glyph. Use
   alternatives or less detailled one as a fallback.
ArthurSonzogni added a commit that referenced this issue Jul 3, 2021
I finally got access to a computer using the Microsoft's Windows OS.
That's the opportunity to find and mitigate all the problems
encountered. This patch:

1. Introduce an option and a C++ definition to enable fallback for
   Microsoft's terminal emulators. This allows me to see/test the
   Microsoft output from Linux. This also allows Windows users to remove
   the fallback and target non Microsoft terminals if needed.

2. Microsoft's terminals do not provide a way to query if they support
   colors. As a fallback, assume true colors is supported.
   See issue:
   - microsoft/terminal#1040
   This mitigates:
   - #135

3. Microsoft terminal do not handle properly hidding the cursor. Instead
   the character under the cursor is hidden, which is a big problem. As
   a result, we don't enable setting the cursor to the best position for
   [input method editors](https://en.wikipedia.org/wiki/Input_method),
   It will be displayed at the bottom right corner.
   See:
   - microsoft/terminal#1203
   - microsoft/terminal#3093

4. The "cmd" on Windows do not properly report its dimension. Powershell
   works correctly. As a fallback, use a 80x80 size instead of 0x0.

5. There are several dom elements and component displayed incorrectly,
   because the font used is missing several unicode glyph. Use
   alternatives or less detailled one as a fallback.
ArthurSonzogni added a commit that referenced this issue Jul 4, 2021
I finally got access to a computer using the Microsoft's Windows OS.
That's the opportunity to find and mitigate all the problems
encountered. This patch:

1. Introduce an option and a C++ definition to enable fallback for
   Microsoft's terminal emulators. This allows me to see/test the
   Microsoft output from Linux. This also allows Windows users to remove
   the fallback and target non Microsoft terminals on Windows if needed.

2. Microsoft's terminal suffer from a race condition bug when reporting
   the cursor position:
   #136
   The mitigation is not to ask for the cursor position in fullscreen
   mode where it isn't really needed and request it less often.
   This fixes: #136

3. Microsoft's terminal do not handle properly hidding the cursor. Instead
   the character under the cursor is hidden, which is a big problem. As
   a result, we don't enable setting the cursor to the best position for
   [input method editors](https://en.wikipedia.org/wiki/Input_method),
   It will be displayed at the bottom right corner.
   See:
   - microsoft/terminal#1203
   - microsoft/terminal#3093

4. Microsoft's terminals do not provide a way to query if they support
   colors. As a fallback, assume true colors is supported.
   See issue:
   - microsoft/terminal#1040
   This mitigates:
   - #135

5. The "cmd" on Windows do not properly report its dimension. Powershell
   works correctly. As a fallback, use a 80x80 size instead of 0x0.

6. There are several dom elements and component displayed incorrectly,
   because the font used is missing several unicode glyph. Use
   alternatives or less detailled one as a fallback.
ArthurSonzogni added a commit that referenced this issue Jul 4, 2021
I finally got access to a computer using the Microsoft's Windows OS.
That's the opportunity to find and mitigate all the problems
encountered. This patch:

1. Introduce an option and a C++ definition to enable fallback for
   Microsoft's terminal emulators. This allows me to see/test the
   Microsoft output from Linux. This also allows Windows users to remove
   the fallback and target non Microsoft terminals on Windows if needed.

2. Microsoft's terminal suffer from a race condition bug when reporting
   the cursor position:
   microsoft/terminal#7583.
   The mitigation is not to ask for the cursor position in fullscreen
   mode where it isn't really needed and request it less often.
   This fixes: #136

3. Microsoft's terminal do not handle properly hidding the cursor. Instead
   the character under the cursor is hidden, which is a big problem. As
   a result, we don't enable setting the cursor to the best position for
   [input method editors](https://en.wikipedia.org/wiki/Input_method),
   It will be displayed at the bottom right corner.
   See:
   - microsoft/terminal#1203
   - microsoft/terminal#3093

4. Microsoft's terminals do not provide a way to query if they support
   colors. As a fallback, assume true colors is supported.
   See issue:
   - microsoft/terminal#1040
   This mitigates:
   - #135

5. The "cmd" on Windows do not properly report its dimension. Powershell
   works correctly. As a fallback, use a 80x80 size instead of 0x0.

6. There are several dom elements and component displayed incorrectly,
   because the font used is missing several unicode glyph. Use
   alternatives or less detailled one as a fallback.
ArthurSonzogni added a commit that referenced this issue Jul 4, 2021
I finally got access to a computer using the Microsoft's Windows OS.
That's the opportunity to find and mitigate all the problems
encountered. This patch:

1. Introduce an option and a C++ definition to enable fallback for
   Microsoft's terminal emulators. This allows me to see/test the
   Microsoft output from Linux. This also allows Windows users to remove
   the fallback and target non Microsoft terminals on Windows if needed.

2. Microsoft's terminal suffer from a race condition bug when reporting
   the cursor position:
   microsoft/terminal#7583.
   The mitigation is not to ask for the cursor position in fullscreen
   mode where it isn't really needed and request it less often.
   This fixes: #136

3. Microsoft's terminal do not handle properly hidding the cursor. Instead
   the character under the cursor is hidden, which is a big problem. As
   a result, we don't enable setting the cursor to the best position for
   [input method editors](https://en.wikipedia.org/wiki/Input_method),
   It will be displayed at the bottom right corner.
   See:
   - microsoft/terminal#1203
   - microsoft/terminal#3093

4. Microsoft's terminals do not provide a way to query if they support
   colors. As a fallback, assume true colors is supported.
   See issue:
   - microsoft/terminal#1040
   This mitigates:
   - #135

5. The "cmd" on Windows do not properly report its dimension. Powershell
   works correctly. As a fallback, use a 80x80 size instead of 0x0.

6. There are several dom elements and component displayed incorrectly,
   because the font used is missing several unicode glyph. Use
   alternatives or less detailled one as a fallback.
@ArthurSonzogni
Copy link
Owner

Hey @MichaelGoulding,

Do you think we should close this issue, given the latest patch?

ageh added a commit to ageh/wrapdb that referenced this issue Jul 27, 2022
FTXUI supports a hack [1] for true color support on Windows that is set via a CMake flag. This patch adds the same flag to the Meson build file.

[1] ArthurSonzogni/FTXUI#135
ageh added a commit to ageh/wrapdb that referenced this issue Jul 28, 2022
FTXUI supports a hack [1] for true color support on Windows that is set via a CMake flag. This patch adds the same flag to the Meson build file.

[1] ArthurSonzogni/FTXUI#135
ageh added a commit to ageh/wrapdb that referenced this issue Jul 28, 2022
FTXUI supports a hack [1] for true color support on Windows that is set via a CMake flag. This patch adds the same flag to the Meson build file.

[1] ArthurSonzogni/FTXUI#135
jpakkane pushed a commit to mesonbuild/wrapdb that referenced this issue Jul 28, 2022
FTXUI supports a hack [1] for true color support on Windows that is set via a CMake flag. This patch adds the same flag to the Meson build file.

[1] ArthurSonzogni/FTXUI#135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants