fix: KeyEvent::char needs to ignore modifiers

Fixes #595
This commit is contained in:
Blaž Hrastnik 2021-08-26 09:21:41 +09:00
parent 9d4c301563
commit 28919898e9

View File

@ -15,10 +15,10 @@ pub struct 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> {
match self.code {
KeyCode::Char(ch) if self.modifiers.is_empty() => Some(ch),
KeyCode::Char(ch) => Some(ch),
_ => None,
}
}