Fix incorrect vi mode search origin

Fixes #5460.
This commit is contained in:
Christian Duerr 2021-09-28 08:30:41 +00:00 committed by GitHub
parent b6e05d2dce
commit 8cda3d1405
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Line indicator obstructing vi mode cursor when scrolled into history
- Vi mode search starting in the line below the vi cursor
## 0.9.0

View File

@ -420,6 +420,11 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
if self.terminal.mode().contains(TermMode::VI) {
self.search_state.origin = self.terminal.vi_mode_cursor.point;
self.search_state.display_offset_delta = 0;
// Adjust origin for content moving upward on search start.
if self.terminal.grid().cursor.point.line + 1 == self.terminal.screen_lines() {
self.search_state.origin.line -= 1;
}
} else {
let viewport_top = Line(-(self.terminal.grid().display_offset() as i32)) - 1;
let viewport_bottom = viewport_top + self.terminal.bottommost_line();