ok fix escape key handling for real this time

main
Jordan Orelli 9 months ago
parent 0a821851a3
commit 1d504ff36d

@ -39,7 +39,10 @@ fn is_escape_done(record: &Console::INPUT_RECORD) -> bool {
if record.EventType as u32 == Console::KEY_EVENT { if record.EventType as u32 == Console::KEY_EVENT {
unsafe { unsafe {
let event = record.Event.KeyEvent; 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 { } else {
false false
@ -239,8 +242,6 @@ impl Reader {
let c = as_escape_character(&record).ok_or(InputError::BadEscapeSequence)?; let c = as_escape_character(&record).ok_or(InputError::BadEscapeSequence)?;
if let Some(escape) = self.escapes.step(c) { if let Some(escape) = self.escapes.step(c) {
return Ok(escape); return Ok(escape);
} else {
return Ok(Escape::Empty);
} }
} }
} }
@ -417,7 +418,6 @@ impl EscapeNode {
impl EscapeCursor { impl EscapeCursor {
fn step(&mut self, c: char) -> Option<Escape> { fn step(&mut self, c: char) -> Option<Escape> {
debug!("step: {c}");
let child = self.target.child(c)?; let child = self.target.child(c)?;
match child.as_ref() { match child.as_ref() {
EscapeNode::Terminal { v, .. } => { EscapeNode::Terminal { v, .. } => {

Loading…
Cancel
Save