ui: prompt: Fix typing with alt

pull/671/head
Blaž Hrastnik 3 years ago
parent 46f537d4ce
commit 5cee3b634d

@ -400,18 +400,6 @@ impl Component for Prompt {
}))); })));
match event { match event {
// char or shift char
KeyEvent {
code: KeyCode::Char(c),
modifiers: KeyModifiers::NONE,
}
| KeyEvent {
code: KeyCode::Char(c),
modifiers: KeyModifiers::SHIFT,
} => {
self.insert_char(c);
(self.callback_fn)(cx, &self.line, PromptEvent::Update);
}
KeyEvent { KeyEvent {
code: KeyCode::Char('c'), code: KeyCode::Char('c'),
modifiers: KeyModifiers::CONTROL, modifiers: KeyModifiers::CONTROL,
@ -539,6 +527,14 @@ impl Component for Prompt {
code: KeyCode::Char('q'), code: KeyCode::Char('q'),
modifiers: KeyModifiers::CONTROL, modifiers: KeyModifiers::CONTROL,
} => self.exit_selection(), } => self.exit_selection(),
// any char event that's not combined with control or mapped to any other combo
KeyEvent {
code: KeyCode::Char(c),
modifiers,
} if !modifiers.contains(KeyModifiers::CONTROL) => {
self.insert_char(c);
(self.callback_fn)(cx, &self.line, PromptEvent::Update);
}
_ => (), _ => (),
}; };

Loading…
Cancel
Save