Add ^C binding to cancel search and leave Vi mode

Fixes #4089.
This commit is contained in:
Christian Duerr 2020-08-09 22:57:55 +00:00 committed by GitHub
parent 576252294d
commit 4b516c6365
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 1 deletions

View File

@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Secondary device attributes escape (`CSI > 0 c`)
- Support for colon separated SGR 38/48
- New Ctrl+C binding to cancel search and leave vi mode
### Changed

View File

@ -637,6 +637,7 @@
#- { key: Escape, mode: Vi, action: ClearSelection }
#- { key: I, mode: Vi, action: ScrollToBottom }
#- { key: I, mode: Vi, action: ToggleViMode }
#- { key: C, mods: Control, mode: Vi, action: ToggleViMode }
#- { key: Y, mods: Control, mode: Vi, action: ScrollLineUp }
#- { key: E, mods: Control, mode: Vi, action: ScrollLineDown }
#- { key: G, mode: Vi, action: ScrollToTop }

View File

@ -368,6 +368,7 @@ pub fn default_key_bindings() -> Vec<KeyBinding> {
Escape, +TermMode::VI; Action::ClearSelection;
I, +TermMode::VI; Action::ScrollToBottom;
I, +TermMode::VI; Action::ToggleViMode;
C, ModifiersState::CTRL, +TermMode::VI; Action::ToggleViMode;
Y, ModifiersState::CTRL, +TermMode::VI; Action::ScrollLineUp;
E, ModifiersState::CTRL, +TermMode::VI; Action::ScrollLineDown;
G, +TermMode::VI; Action::ScrollToTop;

View File

@ -832,7 +832,8 @@ impl<'a, T: EventListener, A: ActionContext<T>> Processor<'a, T, A> {
*self.ctx.suppress_chars() = true;
},
(Some(VirtualKeyCode::Escape), _) => {
(Some(VirtualKeyCode::Escape), _)
| (Some(VirtualKeyCode::C), ModifiersState::CTRL) => {
self.ctx.cancel_search();
*self.ctx.suppress_chars() = true;
},