From 013214899ac5ab3fcc42a08ead0f3ca951db077c Mon Sep 17 00:00:00 2001 From: Ulyssa Date: Wed, 20 Mar 2024 22:13:47 -0700 Subject: [PATCH] Ignore key releases on platforms that support it (#220) --- src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index fc38227..d80ef44 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,6 +46,7 @@ use modalkit::crossterm::{ EnableBracketedPaste, EnableFocusChange, Event, + KeyEventKind, }, execute, terminal::{EnterAlternateScreen, LeaveAlternateScreen, SetTitle}, @@ -341,7 +342,13 @@ impl Application { } match read()? { - Event::Key(ke) => return Ok(ke.into()), + Event::Key(ke) => { + if ke.kind == KeyEventKind::Release { + continue; + } + + return Ok(ke.into()); + }, Event::Mouse(_) => { // Do nothing for now. },