1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Merge pull request #94839 from alvinhochun/win-set-console-mode

Combine existing modes when calling SetConsoleMode
This commit is contained in:
Rémi Verschelde
2024-09-18 11:15:22 +02:00
2 changed files with 6 additions and 2 deletions

View File

@@ -2044,7 +2044,9 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
// NOTE: The engine does not use ANSI escape codes to color error/warning messages; it uses Windows API calls instead.
// Therefore, error/warning messages are still colored on Windows versions older than 10.
HANDLE stdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD outMode = ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
DWORD outMode = 0;
GetConsoleMode(stdoutHandle, &outMode);
outMode |= ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
if (!SetConsoleMode(stdoutHandle, outMode)) {
// Windows 8.1 or below, or Windows 10 prior to Anniversary Update.
print_verbose("Can't set the ENABLE_VIRTUAL_TERMINAL_PROCESSING Windows console mode. `print_rich()` will not work as expected.");