From d0350658ac3df17e1b4661cbbb103063721d5f31 Mon Sep 17 00:00:00 2001 From: xxanqw Date: Sun, 30 Nov 2025 00:36:35 +0200 Subject: Fix Windows ANSI detection and enhance color debugging output --- src/main.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 90fc061..23683b4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -167,7 +167,7 @@ pub fn parse_color_args(args: &Args) -> Result> { // Determine if ANSI is enabled (Windows toggle helper) — don't enable if --no-color #[cfg(windows)] - let ansi_enabled = !args.no_color && enable_windows_ansi(); + let ansi_enabled = !args.no_color && color::enable_windows_ansi(); #[cfg(not(windows))] let ansi_enabled = false; @@ -505,6 +505,19 @@ fn main() -> Result<(), Box> { // Parse color-related arguments let mut color_config = parse_color_args(&args)?; + if color_config.debug { + println!("Detected color mode: {:?}", color_config.mode); + println!("ANSI enabled: {}", color_config.ansi_enabled); + println!("NO_COLOR: {:?}", std::env::var("NO_COLOR").ok()); + println!("COLORTERM: {:?}", std::env::var("COLORTERM").ok()); + println!("TERM: {:?}", std::env::var("TERM").ok()); + #[cfg(windows)] + { + println!("Windows shell hint: {:?}", color::detect_windows_shell()); + } + return Ok(()); + } + // If color debug is requested, print information and exit if args.color_debug { eprintln!("Color Debug: mode={:?}, ansi_enabled={}, rainbow={}, saturation={}, brightness={}", -- cgit v1.3-2-g0d8e