From 1d504ff36d7bc914406f71a962cd0c54d4fa6aa5 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sat, 17 Feb 2024 13:55:21 -0600 Subject: [PATCH] ok fix escape key handling for real this time --- src/input.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/input.rs b/src/input.rs index 01705a1..7d0eb97 100644 --- a/src/input.rs +++ b/src/input.rs @@ -39,7 +39,10 @@ fn is_escape_done(record: &Console::INPUT_RECORD) -> bool { if record.EventType as u32 == Console::KEY_EVENT { unsafe { let event = record.Event.KeyEvent; - event.wVirtualKeyCode == 0 && event.uChar.UnicodeChar == 27 && !event.bKeyDown.as_bool() + // This is a key up event for the physical escape key + event.wVirtualKeyCode == 27 + && event.uChar.UnicodeChar == 27 + && !event.bKeyDown.as_bool() } } else { false @@ -239,8 +242,6 @@ impl Reader { let c = as_escape_character(&record).ok_or(InputError::BadEscapeSequence)?; if let Some(escape) = self.escapes.step(c) { return Ok(escape); - } else { - return Ok(Escape::Empty); } } } @@ -417,7 +418,6 @@ impl EscapeNode { impl EscapeCursor { fn step(&mut self, c: char) -> Option { - debug!("step: {c}"); let child = self.target.child(c)?; match child.as_ref() { EscapeNode::Terminal { v, .. } => {