Commit 013214899a

013214899ac5ab3fcc42a08ead0f3ca951db077c

parent: 8a5049fb25

Unregistered key

Ulyssa <git@ulyssa.dev> · 2024-03-21 05:13 UTC
committer: <noreply@github.com>

Ignore key releases on platforms that support it (#220)

Layout: unified · split

src/main.rs +8 −1
@@ -46,6 +46,7 @@ use modalkit::crossterm::{
46 EnableBracketedPaste, 46 EnableBracketedPaste,
47 EnableFocusChange, 47 EnableFocusChange,
48 Event, 48 Event,
49 KeyEventKind,
49 }, 50 },
50 execute, 51 execute,
51 terminal::{EnterAlternateScreen, LeaveAlternateScreen, SetTitle}, 52 terminal::{EnterAlternateScreen, LeaveAlternateScreen, SetTitle},
@@ -341,7 +342,13 @@ impl Application {
341 } 342 }
342 343
343 match read()? { 344 match read()? {
344 Event::Key(ke) => return Ok(ke.into()), 345 Event::Key(ke) => {
346 if ke.kind == KeyEventKind::Release {
347 continue;
348 }
349
350 return Ok(ke.into());
351 },
345 Event::Mouse(_) => { 352 Event::Mouse(_) => {
346 // Do nothing for now. 353 // Do nothing for now.
347 }, 354 },