1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00

Fix selection change after leaving vi-mode

This patch fixes that the right point of the selection range moves to
another point when leaves vi-mode with a selection by ToggleViMode.
The cause is that always moves a vi-mode cursor to a search origin
whether or not the current search is active.

This problem is a regression which is introduced by #5945.
This commit is contained in:
a5ob7r 2022-05-23 09:01:46 +09:00 committed by GitHub
parent 394b3ffd81
commit c10888b0f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -770,7 +770,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
if self.terminal.mode().contains(TermMode::VI) { if self.terminal.mode().contains(TermMode::VI) {
// If we had search running when leaving Vi mode we should mark terminal fully damaged // If we had search running when leaving Vi mode we should mark terminal fully damaged
// to cleanup highlighted results. // to cleanup highlighted results.
if self.search_state.dfas().is_some() { if self.search_state.dfas.take().is_some() {
self.terminal.mark_fully_damaged(); self.terminal.mark_fully_damaged();
} else { } else {
// Damage line indicator and Vi cursor. // Damage line indicator and Vi cursor.
@ -781,7 +781,10 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
self.clear_selection(); self.clear_selection();
} }
if self.search_active() {
self.cancel_search(); self.cancel_search();
}
self.terminal.toggle_vi_mode(); self.terminal.toggle_vi_mode();
*self.dirty = true; *self.dirty = true;