summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2021-01-08 16:40:45 +0000
committerChristian Duerr <contact@christianduerr.com>2021-01-08 21:54:38 +0000
commit8e74e57bad8a1f6adf078314b6007617897d6c43 (patch)
treef500e724a880bd52bc215dede4704e9eb56e8210
parent97fc6c777769387e60c2dbc5880569658e8d23ba (diff)
Fix jumping between matches in reverse vi search
Fixes #4676.
-rw-r--r--CHANGELOG.md8
-rw-r--r--alacritty/src/input.rs16
2 files changed, 18 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c7b0b416..2b441b9b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,14 @@ The sections should follow the order `Packaging`, `Added`, `Changed`, `Fixed` an
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## 0.8.0-dev
+
+## 0.7.1
+
+### Fixed
+
+- Jumping between matches in backward vi search
+
## 0.7.0
### Added
diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs
index 2be0c8c4..155fab07 100644
--- a/alacritty/src/input.rs
+++ b/alacritty/src/input.rs
@@ -176,10 +176,12 @@ impl<T: EventListener> Execute<T> for Action {
},
Action::ViAction(ViAction::SearchNext) => {
let terminal = ctx.terminal();
- let origin = terminal
- .visible_to_buffer(terminal.vi_mode_cursor.point)
- .add_absolute(terminal, Boundary::Wrap, 1);
let direction = ctx.search_direction();
+ let vi_point = terminal.visible_to_buffer(terminal.vi_mode_cursor.point);
+ let origin = match direction {
+ Direction::Right => vi_point.add_absolute(terminal, Boundary::Wrap, 1),
+ Direction::Left => vi_point.sub_absolute(terminal, Boundary::Wrap, 1),
+ };
let regex_match = terminal.search_next(origin, direction, Side::Left, None);
if let Some(regex_match) = regex_match {
@@ -188,10 +190,12 @@ impl<T: EventListener> Execute<T> for Action {
},
Action::ViAction(ViAction::SearchPrevious) => {
let terminal = ctx.terminal();
- let origin = terminal
- .visible_to_buffer(terminal.vi_mode_cursor.point)
- .sub_absolute(terminal, Boundary::Wrap, 1);
let direction = ctx.search_direction().opposite();
+ let vi_point = terminal.visible_to_buffer(terminal.vi_mode_cursor.point);
+ let origin = match direction {
+ Direction::Right => vi_point.add_absolute(terminal, Boundary::Wrap, 1),
+ Direction::Left => vi_point.sub_absolute(terminal, Boundary::Wrap, 1),
+ };
let regex_match = terminal.search_next(origin, direction, Side::Left, None);
if let Some(regex_match) = regex_match {