diff --git a/src/key.rs b/src/key.rs index 01e94ed90..925dd6c1b 100644 --- a/src/key.rs +++ b/src/key.rs @@ -459,6 +459,9 @@ pub fn char_to_symbol(c: char) -> WString { let buf = &mut buff; if 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}' { // ASCII characters that are not control characters ascii_printable_to_symbol(buf, c); diff --git a/tests/pexpects/fkr.py b/tests/pexpects/fkr.py index d8c081801..69b7248cb 100644 --- a/tests/pexpects/fkr.py +++ b/tests/pexpects/fkr.py @@ -29,11 +29,13 @@ expect_str("Press a key:") # Is a single control char echoed correctly? send("\x07") +expect_str("# decoded from: \\x07\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? sleep(0.020) send("\x1B") +expect_str("# decoded from: \\e\r\n") expect_str("bind escape 'do something'\r\n") send("\u1234") expect_str("bind ሴ 'do something'\r\n") @@ -44,6 +46,7 @@ send("\x00") expect_str("bind ctrl-space 'do something'\r\n") send("\x1b\x7f") +expect_str("# decoded from: \\e\\x7f\r\n") expect_str("bind alt-backspace 'do something'\r\n") send("\x1c")