From 0e23e4f882ec840bed0e2c1ef3723deb7a258801 Mon Sep 17 00:00:00 2001 From: Lennard Hofmann Date: Sat, 19 Nov 2022 18:08:03 +0100 Subject: [PATCH] Make `r` and `f` work (#4817) Previously, commands such as `r` (replace with tab) or `t` (select till tab) had no effect. This is because `KeyCode::Tab` needs special treatment (like `KeyCode::Enter`). --- helix-term/src/commands.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index b00e02b94..1b0c557e6 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1131,6 +1131,10 @@ where doc!(cx.editor).line_ending.as_str().chars().next().unwrap() } + KeyEvent { + code: KeyCode::Tab, .. + } => '\t', + KeyEvent { code: KeyCode::Char(ch), .. @@ -1277,6 +1281,9 @@ fn replace(cx: &mut Context) { code: KeyCode::Enter, .. } => Some(doc.line_ending.as_str()), + KeyEvent { + code: KeyCode::Tab, .. + } => Some("\t"), _ => None, };