aboutsummaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorJJ Liebig <jonathan.liebig@gmail.com>2026-09-03 17:20:57 +0200
committerGitHub <noreply@github.com>2026-09-03 17:20:57 +0200
commit0496636dc75db14a99aa71a7cadb006dc027d5c6 (patch)
tree943d44ed4474ccc9e39ee527a44f00365c81dfbb /src/input
parent0f8ad128b65869d683253753a477c0ccafca9bf2 (diff)
fix(windows): preserve ctrl+slash key identity (#3578)
refs #2954
Diffstat (limited to 'src/input')
-rw-r--r--src/input/encode.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/input/encode.rs b/src/input/encode.rs
index 6dfff4ce..1dd56351 100644
--- a/src/input/encode.rs
+++ b/src/input/encode.rs
@@ -501,7 +501,7 @@ fn encode_legacy_inner(key: TerminalKey) -> Vec<u8> {
']' | '5' => vec![29],
'^' | '6' => vec![30],
'_' | '/' | '7' | '-' => vec![31],
- _ => vec![ch as u8],
+ _ => ch.to_string().into_bytes(),
}
} else {
let ch = if key.modifiers == KeyModifiers::SHIFT {
@@ -590,6 +590,12 @@ mod tests {
}
#[test]
+ fn legacy_ctrl_non_ascii_char_uses_utf8() {
+ let key = KeyEvent::new(KeyCode::Char('ß'), KeyModifiers::CONTROL);
+ assert_eq!(encode_key(key, KeyboardProtocol::Legacy), "ß".as_bytes());
+ }
+
+ #[test]
fn legacy_shift_enter_is_just_cr() {
let key = KeyEvent::new(KeyCode::Enter, KeyModifiers::SHIFT);
assert_eq!(encode_key(key, KeyboardProtocol::Legacy), vec![b'\r']);