From ead54b68830830f16432defec761991b812b5989 Mon Sep 17 00:00:00 2001 From: sigmaSd Date: Fri, 1 Sep 2023 02:28:41 +0100 Subject: [PATCH] fix(windows): don't send key twice (#280) --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 6361d119d..84bbb6684 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,7 +19,7 @@ use std::{ }; use crossterm::{ - event::{Event, KeyCode, KeyEvent, KeyModifiers}, + event::{Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers}, terminal, }; use display::{elapsed_time, RawTerminalBackend, Ui}; @@ -229,11 +229,13 @@ where Event::Key(KeyEvent { modifiers: KeyModifiers::CONTROL, code: KeyCode::Char('c'), + kind: KeyEventKind::Press, .. }) | Event::Key(KeyEvent { modifiers: KeyModifiers::NONE, code: KeyCode::Char('q'), + kind: KeyEventKind::Press, .. }) => { running.store(false, Ordering::Release); @@ -253,6 +255,7 @@ where Event::Key(KeyEvent { modifiers: KeyModifiers::NONE, code: KeyCode::Char(' '), + kind: KeyEventKind::Press, .. }) => { let restarting = paused.fetch_xor(true, Ordering::SeqCst); @@ -272,6 +275,7 @@ where Event::Key(KeyEvent { modifiers: KeyModifiers::NONE, code: KeyCode::Tab, + kind: KeyEventKind::Press, .. }) => { let paused = paused.load(Ordering::SeqCst);