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.
This commit is contained in:
Johannes Altmanninger
2025-04-12 17:23:30 +02:00
parent 76dbd76c73
commit 007eda2f89

View File

@@ -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);