mirror of
https://github.com/rclone/rclone.git
synced 2025-08-19 09:52:05 +02:00
lib/terminal: enable windows console virtual terminal sequences processing (ANSI/VT100 colors)
This ensures the virtual terminal processing mode is enabled on the rclone process for Windows 10 consoles (by using Windows Console API functions GetConsoleMode/SetConsoleMode and flag ENABLE_VIRTUAL_TERMINAL_PROCESSING), which adds native support for ANSI/VT100 escape sequences. This mode is default in many cases, e.g. when using the Windows Terminal application, but in other cases it is not, and the default can also be controlled with registry setting (see below), and therefore configuring it on the process seem to be the only reliable way of ensuring it is enabled when supported. [HKEY_CURRENT_USER\Console] "VirtualTerminalLevel"=dword:00000001
This commit is contained in:
@@ -401,9 +401,15 @@ func initConfig() {
|
||||
// Start accounting
|
||||
accounting.Start(ctx)
|
||||
|
||||
// Hide console window
|
||||
// Configure console
|
||||
if ci.NoConsole {
|
||||
// Hide the console window
|
||||
terminal.HideConsole()
|
||||
} else {
|
||||
// Enable color support on stdout if possible.
|
||||
// This enables virtual terminal processing on Windows 10,
|
||||
// adding native support for ANSI/VT100 escape sequences.
|
||||
terminal.EnableColorsStdout()
|
||||
}
|
||||
|
||||
// Load filters
|
||||
|
Reference in New Issue
Block a user