From fe3df68d7f654964453100e71f7b1c39ee8175ae Mon Sep 17 00:00:00 2001 From: "Christian W. Zuckschwerdt" Date: Thu, 30 Mar 2023 10:49:46 +0200 Subject: [PATCH] minor: Fix Windows Legacy Console mode term colors --- src/term_ctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/term_ctl.c b/src/term_ctl.c index ae2144c48..014f32668 100644 --- a/src/term_ctl.c +++ b/src/term_ctl.c @@ -186,6 +186,11 @@ static void *_term_init(FILE *fp) GetConsoleMode(console->hnd, &dwMode); dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; SetConsoleMode(console->hnd, dwMode); + // Check if it worked, it will fail for Legacy console-mode + GetConsoleMode (console->hnd, &dwMode); + if (!(dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING)) { + console->ansi = 0; + } } _term_set_color(console, FALSE, TERM_COLOR_RESET); /* Set 'console->fg' and 'console->bg' */