Fix selection after search without match
This resolves an issue where the last match would be selected after leaving non-vi search, even if further changes to the search regex did not result in any matches. Fixes #4831.
This commit is contained in:
parent
369c927d9d
commit
35e6fdaddd
|
@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Alacritty failing to start on X11 with invalid DPI reported by XRandr
|
- Alacritty failing to start on X11 with invalid DPI reported by XRandr
|
||||||
|
- Text selected after search without any match
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
|
|
@ -730,6 +730,9 @@ impl<'a, N: Notify + 'a, T: EventListener> ActionContext<'a, N, T> {
|
||||||
// Unschedule pending timers.
|
// Unschedule pending timers.
|
||||||
self.scheduler.unschedule(TimerId::DelayedSearch);
|
self.scheduler.unschedule(TimerId::DelayedSearch);
|
||||||
|
|
||||||
|
// Clear focused match.
|
||||||
|
self.search_state.focused_match = None;
|
||||||
|
|
||||||
// The viewport reset logic is only needed for vi mode, since without it our origin is
|
// The viewport reset logic is only needed for vi mode, since without it our origin is
|
||||||
// always at the current display offset instead of at the vi cursor position which we need
|
// always at the current display offset instead of at the vi cursor position which we need
|
||||||
// to recover to.
|
// to recover to.
|
||||||
|
@ -741,9 +744,6 @@ impl<'a, N: Notify + 'a, T: EventListener> ActionContext<'a, N, T> {
|
||||||
self.terminal.scroll_display(Scroll::Delta(self.search_state.display_offset_delta));
|
self.terminal.scroll_display(Scroll::Delta(self.search_state.display_offset_delta));
|
||||||
self.search_state.display_offset_delta = 0;
|
self.search_state.display_offset_delta = 0;
|
||||||
|
|
||||||
// Clear focused match.
|
|
||||||
self.search_state.focused_match = None;
|
|
||||||
|
|
||||||
// Reset vi mode cursor.
|
// Reset vi mode cursor.
|
||||||
let mut origin = self.search_state.origin;
|
let mut origin = self.search_state.origin;
|
||||||
origin.line = min(origin.line, self.terminal.screen_lines() - 1);
|
origin.line = min(origin.line, self.terminal.screen_lines() - 1);
|
||||||
|
|
Loading…
Reference in New Issue