on master help sign in
ui: prompt: Fix typing with alt
5cee3b6Blaž Hrastnik
helix-term/src/ui/prompt.rs+8−12
@@ -400,18 +400,6 @@ impl Component for Prompt {
400 })));
400 })));
401
401
402 match event {
402 match event {
403− // char or shift char
404− KeyEvent {
405− code: KeyCode::Char(c),
406− modifiers: KeyModifiers::NONE,
407− }
408− | KeyEvent {
409− code: KeyCode::Char(c),
410− modifiers: KeyModifiers::SHIFT,
411− } => {
412− self.insert_char(c);
413− (self.callback_fn)(cx, &self.line, PromptEvent::Update);
414− }
415 KeyEvent {
403 KeyEvent {
416 code: KeyCode::Char('c'),
404 code: KeyCode::Char('c'),
417 modifiers: KeyModifiers::CONTROL,
405 modifiers: KeyModifiers::CONTROL,
@@ -539,6 +527,14 @@ impl Component for Prompt {
539 code: KeyCode::Char('q'),
527 code: KeyCode::Char('q'),
540 modifiers: KeyModifiers::CONTROL,
528 modifiers: KeyModifiers::CONTROL,
541 } => self.exit_selection(),
529 } => self.exit_selection(),
530+ // any char event that's not combined with control or mapped to any other combo
531+ KeyEvent {
532+ code: KeyCode::Char(c),
533+ modifiers,
534+ } if !modifiers.contains(KeyModifiers::CONTROL) => {
535+ self.insert_char(c);
536+ (self.callback_fn)(cx, &self.line, PromptEvent::Update);
537+ }
542 _ => (),
538 _ => (),
543 };
539 };
544
540