on master help sign in
ui: prompt: Fix typing with alt
commit5cee3b634d3763dfdb0312d1dc58f6ebcfccb4bf authorBlaž Hrastnik <blaz@mxxn.io> dateFri 27 Aug 2021, 16:39 (5 years ago) parent46f537d
1 file changed+8−12
helix-term/src/ui/prompt.rs+8−12
helix-term/src/ui/prompt.rs+8−12
@@ -400,18 +400,6 @@ impl Component for Prompt {
400400 })));
401401
402402 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− }
415403 KeyEvent {
416404 code: KeyCode::Char('c'),
417405 modifiers: KeyModifiers::CONTROL,
@@ -539,6 +527,14 @@ impl Component for Prompt {
539527 code: KeyCode::Char('q'),
540528 modifiers: KeyModifiers::CONTROL,
541529 } => 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+ }
542538 _ => (),
543539 };
544540