We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 269a520 commit bdfe215Copy full SHA for bdfe215
1 file changed
src/main.rs
@@ -69,8 +69,9 @@ fn run() -> Result<(), AppError> {
69
let mut s = state_clone.lock().unwrap();
70
match event.event_type {
71
EventType::KeyPress(key) => {
72
- s.pressed_keys.insert(key);
73
- s.kps_events.push(Instant::now());
+ if s.pressed_keys.insert(key) {
+ s.kps_events.push(Instant::now());
74
+ }
75
}
76
EventType::KeyRelease(key) => {
77
s.pressed_keys.remove(&key);
0 commit comments