fix(input): decode 0x1f as Ctrl+_ not Ctrl+- per ASCII standard (#2165)

* fix(input): decode 0x1f as Ctrl+_ not Ctrl+- per ASCII standard

refs #2164

* fix(input): update control-byte matrix test for 0x1f -> Ctrl+_
This commit is contained in:
serhat dolmaci
2026-08-01 19:34:29 +03:00
committed by GitHub
parent 679584fdd4
commit d950fdfe7d
+2 -2
View File
@@ -119,7 +119,7 @@ fn parse_legacy_ctrl_char(ch: char) -> Option<TerminalKey> {
28 => Some(TerminalKey::new(KeyCode::Char('\\'), KeyModifiers::CONTROL)),
29 => Some(TerminalKey::new(KeyCode::Char(']'), KeyModifiers::CONTROL)),
30 => Some(TerminalKey::new(KeyCode::Char('^'), KeyModifiers::CONTROL)),
31 => Some(TerminalKey::new(KeyCode::Char('-'), KeyModifiers::CONTROL)),
31 => Some(TerminalKey::new(KeyCode::Char('_'), KeyModifiers::CONTROL)),
_ => None,
}
}
@@ -792,7 +792,7 @@ mod tests {
(b'\x1c', '\\'),
(b'\x1d', ']'),
(b'\x1e', '^'),
(b'\x1f', '-'),
(b'\x1f', '_'),
] {
let key = parse_terminal_key_sequence(std::str::from_utf8(&[byte]).unwrap()).unwrap();
assert_terminal_key_eq(