From 900cec4df4094f2de5ee626c767dfb8371e08e79 Mon Sep 17 00:00:00 2001 From: Hiers Date: Sat, 14 Oct 2023 18:02:32 +0100 Subject: [PATCH] Fix broken coloured text on Windows. --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index dadab93..e3c73de 100644 --- a/src/main.rs +++ b/src/main.rs @@ -522,11 +522,13 @@ fn terminal_size() -> Result { #[cfg(windows)] fn terminal_size() -> Result { use windows_sys::Win32::System::Console::*; + if let Err(e) = control::set_virtual_terminal(true) { + panic!("Could not set terminal as virtual: {:?}", e); + } unsafe { let handle = GetStdHandle(STD_OUTPUT_HANDLE) as windows_sys::Win32::Foundation::HANDLE; - /* Unlike the linux function, rust will complain if only part of the struct is sent */ let mut window = CONSOLE_SCREEN_BUFFER_INFO { dwSize: COORD { X: 0, Y: 0}, dwCursorPosition: COORD { X: 0, Y: 0},