aboutsummaryrefslogtreecommitdiff
path: root/src/raw_input.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-08 03:54:30 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-08 03:55:02 +0300
commit580db93eccc9f03cdc31841e294b8c18855013f6 (patch)
treed5f46e05f16ccf425d8bd2bbe89a2ac04259df87 /src/raw_input.rs
parenta62ecd71e6fc69c01346d85d54b6264039ab2093 (diff)
fix: handle application keypad input
refs #493
Diffstat (limited to 'src/raw_input.rs')
-rw-r--r--src/raw_input.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/raw_input.rs b/src/raw_input.rs
index a03526d8..8925e4a4 100644
--- a/src/raw_input.rs
+++ b/src/raw_input.rs
@@ -953,6 +953,7 @@ mod tests {
(b"\x1b[127;3u", KeyCode::Backspace, KeyModifiers::ALT),
(b"\x1b[57420;1u", KeyCode::Down, KeyModifiers::empty()),
(b"\x1b[57423;1u", KeyCode::Home, KeyModifiers::empty()),
+ (b"\x1bOq", KeyCode::Char('1'), KeyModifiers::empty()),
(b"\x1b[49:33;2:1u", KeyCode::Char('1'), KeyModifiers::SHIFT),
];
@@ -964,6 +965,29 @@ mod tests {
}
#[test]
+ fn raw_framer_waits_for_application_keypad_sequence_final_byte() {
+ let mut framer = RawInputFramer::default();
+
+ assert!(framer.push(b"\x1bO").is_empty());
+ let events = framer.push(b"q");
+
+ assert_eq!(events.len(), 1);
+ assert_raw_key(
+ events.into_iter().next().unwrap(),
+ KeyCode::Char('1'),
+ KeyModifiers::empty(),
+ );
+ }
+
+ #[test]
+ fn unsupported_ss3_sequence_stays_unsupported() {
+ let (event, consumed) = extract_one_event(b"\x1bOz").unwrap();
+
+ assert_eq!(consumed, 3);
+ assert!(matches!(event, RawInputEvent::Unsupported));
+ }
+
+ #[test]
fn flushes_lone_escape_after_timeout() {
let (tx, mut rx) = mpsc::channel(4);
let mut buffer = vec![ESC];