mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
Convert ASCII DEL to \x7f
Annoying when you press backspace in fish_key_reader
This commit is contained in:
parent
1f7fdd5d88
commit
9903eb4c76
|
@ -459,6 +459,9 @@ pub fn char_to_symbol(c: char) -> WString {
|
||||||
let buf = &mut buff;
|
let buf = &mut buff;
|
||||||
if c <= ' ' {
|
if c <= ' ' {
|
||||||
ctrl_to_symbol(buf, c);
|
ctrl_to_symbol(buf, c);
|
||||||
|
} else if c == '\u{7f}' {
|
||||||
|
// DEL is at the end of the ASCII range
|
||||||
|
sprintf!(=> buf, "\\x%02x", 0x7f);
|
||||||
} else if c < '\u{80}' {
|
} else if c < '\u{80}' {
|
||||||
// ASCII characters that are not control characters
|
// ASCII characters that are not control characters
|
||||||
ascii_printable_to_symbol(buf, c);
|
ascii_printable_to_symbol(buf, c);
|
||||||
|
|
|
@ -29,11 +29,13 @@ expect_str("Press a key:")
|
||||||
|
|
||||||
# Is a single control char echoed correctly?
|
# Is a single control char echoed correctly?
|
||||||
send("\x07")
|
send("\x07")
|
||||||
|
expect_str("# decoded from: \\x07\r\n")
|
||||||
expect_str("bind ctrl-g 'do something'\r\n")
|
expect_str("bind ctrl-g 'do something'\r\n")
|
||||||
|
|
||||||
# Is a non-ASCII UTF-8 sequence prefaced by an escape char handled correctly?
|
# Is a non-ASCII UTF-8 sequence prefaced by an escape char handled correctly?
|
||||||
sleep(0.020)
|
sleep(0.020)
|
||||||
send("\x1B")
|
send("\x1B")
|
||||||
|
expect_str("# decoded from: \\e\r\n")
|
||||||
expect_str("bind escape 'do something'\r\n")
|
expect_str("bind escape 'do something'\r\n")
|
||||||
send("\u1234")
|
send("\u1234")
|
||||||
expect_str("bind ሴ 'do something'\r\n")
|
expect_str("bind ሴ 'do something'\r\n")
|
||||||
|
@ -44,6 +46,7 @@ send("\x00")
|
||||||
expect_str("bind ctrl-space 'do something'\r\n")
|
expect_str("bind ctrl-space 'do something'\r\n")
|
||||||
|
|
||||||
send("\x1b\x7f")
|
send("\x1b\x7f")
|
||||||
|
expect_str("# decoded from: \\e\\x7f\r\n")
|
||||||
expect_str("bind alt-backspace 'do something'\r\n")
|
expect_str("bind alt-backspace 'do something'\r\n")
|
||||||
|
|
||||||
send("\x1c")
|
send("\x1c")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user