Skip to content

Commit

Permalink
fix(keyevents): release is ignored, windows reports it, which is bad
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeSchmied committed Mar 23, 2024
1 parent ed1df1d commit 20c4158
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cgol_tui::{app::App, *};
use crossterm::{
event::{self, poll, Event},
event::{self, poll, Event, KeyEventKind},
execute,
terminal::{
disable_raw_mode, enable_raw_mode, size, EnterAlternateScreen, LeaveAlternateScreen,
Expand Down Expand Up @@ -59,6 +59,9 @@ fn run_app<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> io::Result<
// Wait up to `poll_t` for another event
if poll(app.poll_t())? {
if let Event::Key(key) = event::read()? {
if key.kind != KeyEventKind::Press {
return Ok(());
}
match key.code {
kmaps::QUIT => {
break;
Expand Down

0 comments on commit 20c4158

Please sign in to comment.