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

Windows 10 Virtual Terminal Sequence Support #22

Closed
bruxisma opened this issue Jul 6, 2018 · 1 comment · Fixed by #56
Closed

Windows 10 Virtual Terminal Sequence Support #22

bruxisma opened this issue Jul 6, 2018 · 1 comment · Fixed by #56

Comments

@bruxisma
Copy link

bruxisma commented Jul 6, 2018

Hello!

Windows 10 supports VT100 escape sequences with a call to SetConsoleMode and the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag. Using this would give Windows users more features. You can also, for non Windows 10 versions, fallback to the current behavior.

@ikalnytskyi
Copy link
Owner

@slurps-mad-rips thanks for reaching out to me. It's definitely in my TODO, and now I know at least someone would like to have this.

The main challenge right now for me is:

  • Let termcolor to call SetConsoleMode(ENABLE_VIRTUAL_TERMINAL_PROCESSING) on Windows 10 and use ANSI escape sequences.

  • Let users to do the call instead and check whether ENABLE_VIRTUAL_TERMINAL_PROCESSING enabled or not when colored manipulators are used. This I like more in a sense we don't introduce side effect but it would require to introduce additional runtime cost.

  • Use some #define TERMCOLOR_WINDOWS10_ASCII to unconditionally use ASCII sequences if defined.

  • Come up with another idea that will not require additional runtime cost, or will provide a way to do not pay for runtime checks.

I'll think about it and will come up with some solution for sure. :)

ikalnytskyi added a commit that referenced this issue Feb 21, 2021
In order to address a bunch of edge cases this patch introduces a set of
new macros to control Termcolor's behaviour in certain situations. See
changes summary below.

 * Termcolor used to abort compilation if unsupported target platform is
   detected. This patch changes this behaviour since colorization is not
   assumed to be essential and hence it's better to noop rather than
   abort compilation.

 * Termcolor used to always use Windows API when target OS is Windows.
   Now one can define TERMCOLOR_USE_ANSI_ESCAPE_SEQUENCES in order to
   enforce ANSI escape sequences even for Windows. This is useful when
   one wants to use ANSI escape sequences on Windows 10.

   https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences

 * Termcolor used to always colorize output if the platform is detected.
   Now one can define TERMCOLOR_USE_NOOP to turn off colorization and
   trick termcolor to be noop.

Closes #22
Closes #29
Closes #49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants