Skip to content

Commit

Permalink
fix(windows): don't send key twice (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmaSd authored Sep 1, 2023
1 parent e1bdc4c commit ead54b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -272,6 +275,7 @@ where
Event::Key(KeyEvent {
modifiers: KeyModifiers::NONE,
code: KeyCode::Tab,
kind: KeyEventKind::Press,
..
}) => {
let paused = paused.load(Ordering::SeqCst);
Expand Down

0 comments on commit ead54b6

Please sign in to comment.