mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-29 08:41:22 +00:00 
			
		
		
		
	Handle ENABLE_VIRTUAL_TERMINAL_PROCESSING more gracefully on earlier versions of Windows.
				
					
				
			This commit is contained in:
		| @@ -10,6 +10,9 @@ | |||||||
| #include <windows.h> | #include <windows.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <io.h> | #include <io.h> | ||||||
|  | #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING | ||||||
|  | #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 | ||||||
|  | #endif | ||||||
| #else | #else | ||||||
| #include <climits> | #include <climits> | ||||||
| #include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||||
| @@ -68,9 +71,10 @@ namespace console { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if (hConsole) { |         if (hConsole) { | ||||||
|             // Enable ANSI colors on Windows 10+ |             // Check conditions combined to reduce nesting | ||||||
|             if (advanced_display && !(dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING)) { |             if (advanced_display && !(dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) && | ||||||
|                 SetConsoleMode(hConsole, dwMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING); |                 !SetConsoleMode(hConsole, dwMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) { | ||||||
|  |                 advanced_display = false; | ||||||
|             } |             } | ||||||
|             // Set console output codepage to UTF8 |             // Set console output codepage to UTF8 | ||||||
|             SetConsoleOutputCP(CP_UTF8); |             SetConsoleOutputCP(CP_UTF8); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 DannyDaemonic
					DannyDaemonic