fix: KeyEvent::char needs to ignore modifiers

Fixes #595
imgbot
Blaž Hrastnik 3 years ago
parent 9d4c301563
commit 28919898e9

@ -15,10 +15,10 @@ pub struct KeyEvent {
} }
impl KeyEvent { impl KeyEvent {
/// If a character was pressed (without modifiers), return it. /// If a character was pressed, return it.
pub fn char(&self) -> Option<char> { pub fn char(&self) -> Option<char> {
match self.code { match self.code {
KeyCode::Char(ch) if self.modifiers.is_empty() => Some(ch), KeyCode::Char(ch) => Some(ch),
_ => None, _ => None,
} }
} }

Loading…
Cancel
Save