From 69e1bdd62bcb32291b9ba4ac414be5bfab34de2b Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 8 Jan 2018 13:08:55 -0800 Subject: More information on the Windows Console and escape sequences. Change-Id: I8a57053658ef17d28c28c458e8fe5350332a953b Reviewed-on: https://code.wireshark.org/review/25201 Reviewed-by: Guy Harris --- epan/print_stream.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'epan/print_stream.c') diff --git a/epan/print_stream.c b/epan/print_stream.c index 66d9165e8e..a682ebcf85 100644 --- a/epan/print_stream.c +++ b/epan/print_stream.c @@ -49,14 +49,39 @@ print_color_escape(FILE *fh, const color_t *fg, const color_t *bg) * include red, green or blue if the numeric intensity is high * enough. * - * The console in Windows 10 builds 14931 and later supports SGR RGB - * sequences: + * The console in Windows 10 version 1511 (TH2), build 10586, and later + * supports SGR escape sequences: + * + * http://www.nivot.org/blog/post/2016/02/04/Windows-10-TH2-(v1511)-Console-Host-Enhancements + * + * but only supports 16 colors. The "undocumented" 0x04 bit to which + * they refer is documented in the current version of the SetConsoleMode() + * documentation: + * + * https://docs.microsoft.com/en-us/windows/console/setconsolemode + * + * as ENABLE_VIRTUAL_TERMINAL_PROCESSING, saying + * + * When writing with WriteFile or WriteConsole, characters are parsed + * for VT100 and similar control character sequences that control cursor + * movement, color/font mode, and other operations that can also be + * performed via the existing Console APIs. For more information, see + * Console Virtual Terminal Sequences. + * + * Console Virtual Terminal Sequences: + * + * https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences + * + * documents all the escape sequences the Console supports. + * + * The console in Windows 10 builds 14931 (a preview version of Windows 10 + * version 1703) and later supports SGR RGB sequences: * * https://blogs.msdn.microsoft.com/commandline/2016/09/22/24-bit-color-in-the-windows-console/ * * We might want to print those instead depending on the version of * Windows or just remove the SetConsoleTextAttribute calls and only - * print SGR sequences. + * print SGR sequences if they are supported. */ if (fg) { if (((fg->red >> 8) & 0xff) >= 0x80) -- cgit v1.2.3