aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty/src/input.rs')
-rw-r--r--alacritty/src/input.rs26
1 files changed, 19 insertions, 7 deletions
diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs
index cac21f69..2be0c8c4 100644
--- a/alacritty/src/input.rs
+++ b/alacritty/src/input.rs
@@ -24,7 +24,7 @@ use glutin::window::CursorIcon;
use alacritty_terminal::ansi::{ClearMode, Handler};
use alacritty_terminal::event::EventListener;
use alacritty_terminal::grid::{Dimensions, Scroll};
-use alacritty_terminal::index::{Column, Direction, Line, Point, Side};
+use alacritty_terminal::index::{Boundary, Column, Direction, Line, Point, Side};
use alacritty_terminal::selection::SelectionType;
use alacritty_terminal::term::{ClipboardType, SizeInfo, Term, TermMode};
use alacritty_terminal::vi_mode::ViMotion;
@@ -175,26 +175,35 @@ impl<T: EventListener> Execute<T> for Action {
}
},
Action::ViAction(ViAction::SearchNext) => {
- let origin = ctx.terminal().visible_to_buffer(ctx.terminal().vi_mode_cursor.point);
+ 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 regex_match = ctx.terminal().search_next(origin, direction, Side::Left, None);
+ let regex_match = terminal.search_next(origin, direction, Side::Left, None);
if let Some(regex_match) = regex_match {
ctx.terminal_mut().vi_goto_point(*regex_match.start());
}
},
Action::ViAction(ViAction::SearchPrevious) => {
- let origin = ctx.terminal().visible_to_buffer(ctx.terminal().vi_mode_cursor.point);
+ 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 regex_match = ctx.terminal().search_next(origin, direction, Side::Left, None);
+ let regex_match = terminal.search_next(origin, direction, Side::Left, None);
if let Some(regex_match) = regex_match {
ctx.terminal_mut().vi_goto_point(*regex_match.start());
}
},
Action::ViAction(ViAction::SearchStart) => {
let terminal = ctx.terminal();
- let origin = terminal.visible_to_buffer(ctx.terminal().vi_mode_cursor.point);
+ let origin = terminal
+ .visible_to_buffer(terminal.vi_mode_cursor.point)
+ .sub_absolute(terminal, Boundary::Wrap, 1);
+
let regex_match = terminal.search_next(origin, Direction::Left, Side::Left, None);
if let Some(regex_match) = regex_match {
ctx.terminal_mut().vi_goto_point(*regex_match.start());
@@ -202,7 +211,10 @@ impl<T: EventListener> Execute<T> for Action {
},
Action::ViAction(ViAction::SearchEnd) => {
let terminal = ctx.terminal();
- let origin = terminal.visible_to_buffer(ctx.terminal().vi_mode_cursor.point);
+ let origin = terminal
+ .visible_to_buffer(terminal.vi_mode_cursor.point)
+ .add_absolute(terminal, Boundary::Wrap, 1);
+
let regex_match = terminal.search_next(origin, Direction::Right, Side::Right, None);
if let Some(regex_match) = regex_match {
ctx.terminal_mut().vi_goto_point(*regex_match.end());