summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2021-09-28 08:30:41 +0000
committerGitHub <noreply@github.com>2021-09-28 08:30:41 +0000
commit8cda3d140574cbd8bd0fd8e89667ef67a4a1f900 (patch)
treedd810a39f81d910972b9a12bfebd9720c29de2fb
parentb6e05d2dceb80536b54c8ca4085e22075e4527a1 (diff)
downloadalacritty-8cda3d140574cbd8bd0fd8e89667ef67a4a1f900.tar.gz
alacritty-8cda3d140574cbd8bd0fd8e89667ef67a4a1f900.zip
Fix incorrect vi mode search origin
Fixes #5460.
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty/src/event.rs5
2 files changed, 6 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e5be002d..59ad284e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index cc817f6e..37dc2cd1 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -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();