Skip to content

Commit

Permalink
Ignore key releases on platforms that support it (ulyssa#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulyssa authored Mar 21, 2024
1 parent 8a5049f commit 0132148
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ use modalkit::crossterm::{
EnableBracketedPaste,
EnableFocusChange,
Event,
KeyEventKind,
},
execute,
terminal::{EnterAlternateScreen, LeaveAlternateScreen, SetTitle},
Expand Down Expand Up @@ -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.
},
Expand Down

0 comments on commit 0132148

Please sign in to comment.