fix(windows): ignore KeyEventKind::Release events

This commit is contained in:
Erich Gubler 2024-11-10 17:47:50 -05:00
parent 0c13626d4c
commit ac52c71a1c

View File

@ -11,7 +11,7 @@ use crossterm::event::{
BackTab, Backspace, Char, Delete, Down, End, Enter, Esc, Home, Insert, BackTab, Backspace, Char, Delete, Down, End, Enter, Esc, Home, Insert,
Left, PageDown, PageUp, Right, Tab, Up, F, Left, PageDown, PageUp, Right, Tab, Up, F,
}, },
KeyEvent, KeyModifiers, KeyEvent, KeyEventKind, KeyModifiers,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tokio::sync::mpsc; use tokio::sync::mpsc;
@ -214,6 +214,9 @@ impl EventLoop {
pub fn convert_raw_event_to_key(event: KeyEvent) -> Key { pub fn convert_raw_event_to_key(event: KeyEvent) -> Key {
debug!("Raw event: {:?}", event); debug!("Raw event: {:?}", event);
if event.kind == KeyEventKind::Release {
return Key::Null;
}
match event.code { match event.code {
Backspace => match event.modifiers { Backspace => match event.modifiers {
KeyModifiers::CONTROL => Key::CtrlBackspace, KeyModifiers::CONTROL => Key::CtrlBackspace,