Skip to content

Commit

Permalink
Fix selection change after leaving vi-mode
Browse files Browse the repository at this point in the history
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 alacritty#5945.
  • Loading branch information
a5ob7r authored May 23, 2022
1 parent 394b3ff commit c10888b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions alacritty/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
if self.terminal.mode().contains(TermMode::VI) {
// If we had search running when leaving Vi mode we should mark terminal fully damaged
// to cleanup highlighted results.
if self.search_state.dfas().is_some() {
if self.search_state.dfas.take().is_some() {
self.terminal.mark_fully_damaged();
} else {
// Damage line indicator and Vi cursor.
Expand All @@ -781,7 +781,10 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
self.clear_selection();
}

self.cancel_search();
if self.search_active() {
self.cancel_search();
}

self.terminal.toggle_vi_mode();

*self.dirty = true;
Expand Down

0 comments on commit c10888b

Please sign in to comment.