Fix leaving vi mode with active selection

This bug comes from 530de00049. The vi
cursor movement changes text selection range when it is on vi mode. On
the other hand the cursor movement doesn't change the range when it
isn't on vi mode. So preserve text selection range by toggling vi mode
early.
This commit is contained in:
a5ob7r 2021-07-08 07:05:05 +09:00 committed by GitHub
parent 0486c7cb13
commit 72675db382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View file

@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Incorrect vi cursor position after invoking `ScrollPage*` action
- Slow PTY read performance with extremely dense grids
- Crash when resizing during vi mode
- Unintentional text selection range change after leaving vi mode
## 0.8.0

View file

@ -730,11 +730,11 @@
#- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom }
# Vi Mode
#- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom }
#- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode }
#- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom }
#- { key: Escape, mode: Vi|~Search, action: ClearSelection }
#- { key: I, mode: Vi|~Search, action: ScrollToBottom }
#- { key: I, mode: Vi|~Search, action: ToggleViMode }
#- { key: I, mode: Vi|~Search, action: ScrollToBottom }
#- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode }
#- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp }
#- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown }

View file

@ -424,16 +424,16 @@ pub fn default_key_bindings() -> Vec<KeyBinding> {
F19, ~BindingMode::VI, ~BindingMode::SEARCH; Action::Esc("\x1b[33~".into());
F20, ~BindingMode::VI, ~BindingMode::SEARCH; Action::Esc("\x1b[34~".into());
NumpadEnter, ~BindingMode::VI, ~BindingMode::SEARCH; Action::Esc("\n".into());
Space, ModifiersState::SHIFT | ModifiersState::CTRL, +BindingMode::VI, ~BindingMode::SEARCH;
Action::ScrollToBottom;
Space, ModifiersState::SHIFT | ModifiersState::CTRL, ~BindingMode::SEARCH;
Action::ToggleViMode;
Space, ModifiersState::SHIFT | ModifiersState::CTRL, +BindingMode::VI, ~BindingMode::SEARCH;
Action::ScrollToBottom;
Escape, +BindingMode::VI, ~BindingMode::SEARCH;
Action::ClearSelection;
I, +BindingMode::VI, ~BindingMode::SEARCH;
Action::ScrollToBottom;
I, +BindingMode::VI, ~BindingMode::SEARCH;
Action::ToggleViMode;
I, +BindingMode::VI, ~BindingMode::SEARCH;
Action::ScrollToBottom;
C, ModifiersState::CTRL, +BindingMode::VI, ~BindingMode::SEARCH;
Action::ToggleViMode;
Y, ModifiersState::CTRL, +BindingMode::VI, ~BindingMode::SEARCH;