mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 00:41:15 -03:00
fish_indent --ansi to emit SGR0 before final newline
Buggy programs parsing "fish_indent --ansi" output break because we wemit SGR0 after the final newline. I suppose this is weird, and there's no need to wait until after the \n to emit SGR0 so let's move it before that. Closes #12096
This commit is contained in:
@@ -76,6 +76,9 @@ pub fn colorize(text: &wstr, colors: &[HighlightSpec], vars: &dyn Environment) -
|
||||
outp.set_text_face(face);
|
||||
last_color = color;
|
||||
}
|
||||
if i + 1 == text.char_count() && c == '\n' {
|
||||
outp.set_text_face(TextFace::default());
|
||||
}
|
||||
outp.writech(c);
|
||||
}
|
||||
outp.set_text_face(TextFace::default());
|
||||
|
||||
@@ -494,6 +494,12 @@ echo $status #CHECK: 0
|
||||
echo 'PATH={$PATH[echo " "' | $fish_indent --ansi
|
||||
# CHECK: PATH={$PATH[echo " "
|
||||
|
||||
fish_config theme choose "ayu Dark"
|
||||
echo -n 'echo hello' | builtin fish_indent --ansi
|
||||
echo end
|
||||
# CHECK: {{\x1b\[38;2;57;186;230mecho\x1b\[38;2;179;177;173m hello\x1b\[38;2;242;150;104m\x1b\[m}}
|
||||
# CHECK: end
|
||||
|
||||
echo a\> | $fish_indent
|
||||
# CHECK: a >
|
||||
|
||||
|
||||
Reference in New Issue
Block a user