Adds backspace filter to unicode_to_key_event and Key::from branch for backspace
@@ -39,16 +39,16 @@ where
fn unicode_to_key_event(uni_char: u32) -> Option<KeyEvent> {
let mut text = String::new();
- let mut key = Key::Unknown;
- if let Some(character) = char::from_u32(uni_char) {
- if !character.is_control() {
+ let key = if let Some(character) = char::from_u32(uni_char) {
text = character.to_string();
- key = Key::from(character);
- }
- }
+ Key::from(character)
+ } else {
+ Key::Unknown
+ };
+
- if key == Key::Up || key == Key::Down || key == Key::Left || key == Key::Right || Key::Backspace {
+ if key == Key::Up || key == Key::Down || key == Key::Left || key == Key::Right || key == Key::Backspace {
return None;
}
