From 007eda2f8908d584cb8aec63b7f92447c66d31e5 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 12 Apr 2025 17:23:30 +0200 Subject: [PATCH] builtin set_color: fix inconsistent output in --print-colors fish -c 'set_color --print-colors --background blue' |xxd does not print color enabling sequences but does print *disabling* sequences. There's no need for that. --- src/builtins/set_color.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/builtins/set_color.rs b/src/builtins/set_color.rs index 2d556583a..4f096005b 100644 --- a/src/builtins/set_color.rs +++ b/src/builtins/set_color.rs @@ -78,7 +78,7 @@ fn print_colors( } } outp.write_wstr(color_name); - if !bg.is_none() { + if streams.out_is_terminal() && !bg.is_none() { // If we have a background, stop it after the color // or it goes to the end of the line and looks ugly. outp.write_command(ExitAttributeMode);