summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/vi_mode.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-05-30 20:45:44 +0000
committerGitHub <noreply@github.com>2020-05-30 20:45:44 +0000
commit1dacc99183373bffa3ba287aa3241f3b1da67016 (patch)
treed5dbefde927b02bff10e29d8596a0bfab65d88f1 /alacritty_terminal/src/vi_mode.rs
parentf7fb67f870943f3f760826b748c8463b8e434983 (diff)
downloadalacritty-1dacc99183373bffa3ba287aa3241f3b1da67016.tar.gz
alacritty-1dacc99183373bffa3ba287aa3241f3b1da67016.zip
Refactor Term/Grid separation
This commit aims to clear up the separation between Term and Grid to make way for implementing search. The `cursor` and `cursor_save` have been moved to the grid, since they're always bound to their specific grid and this makes updating easier. Since the selection is independent of the active grid, it has been moved to the `Term`.
Diffstat (limited to 'alacritty_terminal/src/vi_mode.rs')
-rw-r--r--alacritty_terminal/src/vi_mode.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs
index 7fa6c148..650c3a8a 100644
--- a/alacritty_terminal/src/vi_mode.rs
+++ b/alacritty_terminal/src/vi_mode.rs
@@ -385,11 +385,10 @@ fn last_occupied_in_line<T>(term: &Term<T>, line: usize) -> Option<Point<usize>>
/// Advance point based on direction.
fn advance<T>(term: &Term<T>, point: Point<usize>, left: bool) -> Point<usize> {
- let cols = term.grid().num_cols();
if left {
- point.sub_absolute(cols.0, 1)
+ point.sub_absolute(term.grid().num_cols(), 1)
} else {
- point.add_absolute(cols.0, 1)
+ point.add_absolute(term.grid().num_cols(), 1)
}
}
@@ -679,7 +678,7 @@ mod tests {
#[test]
fn scroll_semantic() {
let mut term = term();
- term.grid_mut().scroll_up(&(Line(0)..Line(20)), Line(5), &Default::default());
+ term.grid_mut().scroll_up(&(Line(0)..Line(20)), Line(5), Default::default());
let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(0)));
@@ -755,7 +754,7 @@ mod tests {
#[test]
fn scroll_word() {
let mut term = term();
- term.grid_mut().scroll_up(&(Line(0)..Line(20)), Line(5), &Default::default());
+ term.grid_mut().scroll_up(&(Line(0)..Line(20)), Line(5), Default::default());
let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(0)));