Make `r<tab>` and `f<tab>` work (#4817)

Previously, commands such as `r<tab>` (replace with tab) or `t<tab>`
(select till tab) had no effect. This is because `KeyCode::Tab` needs
special treatment (like `KeyCode::Enter`).
pull/4824/head
Lennard Hofmann 2 years ago committed by GitHub
parent 7e99087fa3
commit 0e23e4f882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1131,6 +1131,10 @@ where
doc!(cx.editor).line_ending.as_str().chars().next().unwrap() doc!(cx.editor).line_ending.as_str().chars().next().unwrap()
} }
KeyEvent {
code: KeyCode::Tab, ..
} => '\t',
KeyEvent { KeyEvent {
code: KeyCode::Char(ch), code: KeyCode::Char(ch),
.. ..
@ -1277,6 +1281,9 @@ fn replace(cx: &mut Context) {
code: KeyCode::Enter, code: KeyCode::Enter,
.. ..
} => Some(doc.line_ending.as_str()), } => Some(doc.line_ending.as_str()),
KeyEvent {
code: KeyCode::Tab, ..
} => Some("\t"),
_ => None, _ => None,
}; };

Loading…
Cancel
Save