mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 06:28:58 +08:00
Fix crash displaying CSI u codepoints in ASCII control range
This commit is contained in:
parent
c8f3659737
commit
b97187c90b
|
@ -414,8 +414,11 @@ fn ascii_printable_to_symbol(buf: &mut WString, c: char) {
|
|||
fn char_to_symbol(c: char) -> WString {
|
||||
let mut buff = WString::new();
|
||||
let buf = &mut buff;
|
||||
assert!(c >= ' ');
|
||||
if c < '\u{80}' {
|
||||
if c <= ' ' {
|
||||
// Most ascii control characters like \x01 are canonicalized like ctrl-a, except if we
|
||||
// are given the control character directly with CSI u.
|
||||
sprintf!(=> buf, "\\x%02x", u8::try_from(c).unwrap());
|
||||
} else if c < '\u{80}' {
|
||||
// ASCII characters that are not control characters
|
||||
ascii_printable_to_symbol(buf, c);
|
||||
} else if fish_wcwidth(c) > 0 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user