From 20c415821afec9293e0f83d22d2e343bf21d24dc Mon Sep 17 00:00:00 2001 From: Jeromos Kovacs Date: Sat, 23 Mar 2024 20:28:14 +0100 Subject: [PATCH] fix(keyevents): release is ignored, windows reports it, which is bad --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 94bcfdf..7c8a1f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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, @@ -59,6 +59,9 @@ fn run_app(terminal: &mut Terminal, 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;