aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-client/src
diff options
context:
space:
mode:
authorIvan Smoliakov <self@renesat.me>2026-04-29 15:06:49 +0200
committerGitHub <noreply@github.com>2026-04-29 15:06:49 +0200
commit50bac0807f6f635d7ab6ec3ad0f48b6149d00b92 (patch)
treef4bdcb00ade55bca36c19fee747e3e67050597ad /zellij-client/src
parentImplement DECQRM for CSI2031 (#5111) (diff)
downloadsl0ppij-50bac0807f6f635d7ab6ec3ad0f48b6149d00b92.tar.gz
sl0ppij-50bac0807f6f635d7ab6ec3ad0f48b6149d00b92.tar.xz
sl0ppij-50bac0807f6f635d7ab6ec3ad0f48b6149d00b92.zip
fix: incorrect interpretation of unicode keys (#5110)
Diffstat (limited to 'zellij-client/src')
-rw-r--r--zellij-client/src/keyboard_parser.rs126
1 files changed, 126 insertions, 0 deletions
diff --git a/zellij-client/src/keyboard_parser.rs b/zellij-client/src/keyboard_parser.rs
index 86c29b6d..a5cbe1cd 100644
--- a/zellij-client/src/keyboard_parser.rs
+++ b/zellij-client/src/keyboard_parser.rs
@@ -436,6 +436,24 @@ pub fn can_parse_bare_keys() {
Some(KeyWithModifier::new(BareKey::F(4))),
"Can parse a bare 'F4 (alternate)' keypress"
);
+ let key = "\u{1b}[1087u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('п'))),
+ "Can parse a bare 'п' keypress"
+ );
+ let key = "\u{1b}[1255u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('ӧ'))),
+ "Can parse a bare 'ӧ' keypress"
+ );
+ let key = "\u{1b}[1098u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('ъ'))),
+ "Can parse a bare 'ъ' keypress"
+ );
}
#[test]
@@ -676,6 +694,24 @@ pub fn can_parse_keys_with_shift_modifier() {
Some(KeyWithModifier::new(BareKey::F(4)).with_shift_modifier()),
"Can parse a bare 'F4 (alternate)' keypress with shift"
);
+ let key = "\u{1b}[1087;2u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('п')).with_shift_modifier()),
+ "Can parse a bare 'п' keypress with shift"
+ );
+ let key = "\u{1b}[1255;2u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('ӧ')).with_shift_modifier()),
+ "Can parse a bare 'ӧ' keypress with shift"
+ );
+ let key = "\u{1b}[1098;2u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('ъ')).with_shift_modifier()),
+ "Can parse a bare 'ъ' keypress with shift"
+ );
}
#[test]
@@ -916,6 +952,24 @@ pub fn can_parse_keys_with_alt_modifier() {
Some(KeyWithModifier::new(BareKey::F(4)).with_alt_modifier()),
"Can parse a bare 'F4 (alternate)' keypress with alt"
);
+ let key = "\u{1b}[1087;3u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('п')).with_alt_modifier()),
+ "Can parse a bare 'п' keypress with alt"
+ );
+ let key = "\u{1b}[1255;3u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('ӧ')).with_alt_modifier()),
+ "Can parse a bare 'ӧ' keypress with alt"
+ );
+ let key = "\u{1b}[1098;3u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('ъ')).with_alt_modifier()),
+ "Can parse a bare 'ъ' keypress with alt"
+ );
}
#[test]
@@ -1156,6 +1210,24 @@ pub fn can_parse_keys_with_ctrl_modifier() {
Some(KeyWithModifier::new(BareKey::F(4)).with_ctrl_modifier()),
"Can parse a bare 'F4 (ctrlernate)' keypress with ctrl"
);
+ let key = "\u{1b}[1087;5u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('п')).with_ctrl_modifier()),
+ "Can parse a bare 'п' keypress with ctrl"
+ );
+ let key = "\u{1b}[1255;5u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('ӧ')).with_ctrl_modifier()),
+ "Can parse a bare 'ӧ' keypress with ctrl"
+ );
+ let key = "\u{1b}[1098;5u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('ъ')).with_ctrl_modifier()),
+ "Can parse a bare 'ъ' keypress with ctrl"
+ );
}
#[test]
@@ -1396,6 +1468,24 @@ pub fn can_parse_keys_with_super_modifier() {
Some(KeyWithModifier::new(BareKey::F(4)).with_super_modifier()),
"Can parse a bare 'F4 (alternate)' keypress with super"
);
+ let key = "\u{1b}[1087;9u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('п')).with_super_modifier()),
+ "Can parse a bare 'п' keypress with super"
+ );
+ let key = "\u{1b}[1255;9u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('ӧ')).with_super_modifier()),
+ "Can parse a bare 'ӧ' keypress with super"
+ );
+ let key = "\u{1b}[1098;9u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(KeyWithModifier::new(BareKey::Char('ъ')).with_super_modifier()),
+ "Can parse a bare 'ъ' keypress with super"
+ );
}
#[test]
@@ -1870,6 +1960,42 @@ pub fn can_parse_keys_with_multiple_modifiers() {
),
"Can parse a bare 'F4 (superernate)' keypress with all modifiers"
);
+ let key = "\u{1b}[1087;16u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(
+ KeyWithModifier::new(BareKey::Char('п'))
+ .with_super_modifier()
+ .with_ctrl_modifier()
+ .with_alt_modifier()
+ .with_shift_modifier()
+ ),
+ "Can parse a bare 'п' keypress with all modifiers"
+ );
+ let key = "\u{1b}[1255;16u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(
+ KeyWithModifier::new(BareKey::Char('ӧ'))
+ .with_super_modifier()
+ .with_ctrl_modifier()
+ .with_alt_modifier()
+ .with_shift_modifier()
+ ),
+ "Can parse a bare 'ӧ' keypress with all modifiers"
+ );
+ let key = "\u{1b}[1098;16u";
+ assert_eq!(
+ parse_for_test(key.as_bytes()),
+ Some(
+ KeyWithModifier::new(BareKey::Char('ъ'))
+ .with_super_modifier()
+ .with_ctrl_modifier()
+ .with_alt_modifier()
+ .with_shift_modifier()
+ ),
+ "Can parse a bare 'ъ' keypress with all modifiers"
+ );
}
// =====================================================================