From 4b05d9a3a8807149c0313cbd4781a42626cc2a99 Mon Sep 17 00:00:00 2001 From: wadackel Date: Sun, 14 Jan 2024 17:55:02 +0900 Subject: [PATCH] fix: fixes bug where keys are pressed twice on windows --- src/term.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/term.rs b/src/term.rs index ed1cb47..82de425 100644 --- a/src/term.rs +++ b/src/term.rs @@ -243,10 +243,15 @@ impl Terminal for Term { fn read_key(&mut self) -> Result<(KeyCode, KeyModifiers), Error> { loop { if let Event::Key(KeyEvent { - code, modifiers, .. + code, + modifiers, + kind, + .. }) = event::read()? { - return Ok((code, modifiers)); + if kind == event::KeyEventKind::Press { + return Ok((code, modifiers)); + } } } }