diff options
Diffstat (limited to 'alacritty/src/input.rs')
-rw-r--r-- | alacritty/src/input.rs | 16 |
1 files changed, 10 insertions, 6 deletions
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 { |