Skip to content

Commit 976371b

Browse files
committed
minor: Fix Windows Legacy Console mode term colors
1 parent cb9678b commit 976371b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/term_ctl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ static void *_term_init(FILE *fp)
186186
GetConsoleMode(console->hnd, &dwMode);
187187
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
188188
SetConsoleMode(console->hnd, dwMode);
189+
// Check if it worked, it will fail for Legacy console-mode
190+
GetConsoleMode (console->hnd, &dwMode);
191+
if (!(dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING)) {
192+
console->ansi = 0;
193+
}
189194
}
190195

191196
_term_set_color(console, FALSE, TERM_COLOR_RESET); /* Set 'console->fg' and 'console->bg' */

0 commit comments

Comments
 (0)