diff options
author | Joe Wilm <joe@jwilm.com> | 2017-04-19 20:08:44 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2017-04-19 20:17:06 -0700 |
commit | faa2dc11e470e131f57426699a9f1aa80354695b (patch) | |
tree | 804bb138798b81ee5eb0d80a148a30be5fef6a22 /src/grid.rs | |
parent | 77295e7f9e04660598b0323924c142cde30429f4 (diff) | |
download | alacritty-faa2dc11e470e131f57426699a9f1aa80354695b.tar.gz alacritty-faa2dc11e470e131f57426699a9f1aa80354695b.zip |
Pass scrolling region tests in vttest 2
Diffstat (limited to 'src/grid.rs')
-rw-r--r-- | src/grid.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/grid.rs b/src/grid.rs index af3a8ae4..8d1d051b 100644 --- a/src/grid.rs +++ b/src/grid.rs @@ -152,19 +152,16 @@ impl<T> Grid<T> { #[inline] pub fn scroll_down(&mut self, region: Range<index::Line>, positions: index::Line) { - for line in IndexRange(region).rev() { - let src = line; - let dst = line - positions; - self.swap_lines(src, dst); + for line in IndexRange((region.start + positions)..region.end).rev() { + self.swap_lines(line, line - positions); } } #[inline] pub fn scroll_up(&mut self, region: Range<index::Line>, positions: index::Line) { - for line in IndexRange(region) { - let src = line; - let dst = line + positions; - self.swap_lines(src, dst); + + for line in IndexRange(region.start..(region.end - positions)) { + self.swap_lines(line, line + positions); } } @@ -622,7 +619,7 @@ mod tests { info!("grid: {:?}", grid); - grid.scroll_up(Line(0)..Line(8), Line(2)); + grid.scroll_up(Line(0)..Line(10), Line(2)); info!("grid: {:?}", grid); @@ -656,7 +653,7 @@ mod tests { info!("grid: {:?}", grid); - grid.scroll_down(Line(2)..Line(10), Line(2)); + grid.scroll_down(Line(0)..Line(10), Line(2)); info!("grid: {:?}", grid); |