aboutsummaryrefslogtreecommitdiff
path: root/src/grid/mod.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2018-02-16 18:35:54 -0800
committerJoe Wilm <joe@jwilm.com>2018-03-07 09:47:21 -0800
commit40298c50e2890950a29782b247f2ec14f5b7af8b (patch)
treec3c9c18b9d4edd8961f049529fed30c0d2ce59b9 /src/grid/mod.rs
parent5c648a34aabf9c9805eced4f3b5443310a4cd461 (diff)
downloadalacritty-40298c50e2890950a29782b247f2ec14f5b7af8b.tar.gz
alacritty-40298c50e2890950a29782b247f2ec14f5b7af8b.zip
Fix scrolling backwards in tmux
Diffstat (limited to 'src/grid/mod.rs')
-rw-r--r--src/grid/mod.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/grid/mod.rs b/src/grid/mod.rs
index 1cb0876e..ca43471d 100644
--- a/src/grid/mod.rs
+++ b/src/grid/mod.rs
@@ -157,6 +157,10 @@ impl<T: Copy + Clone> Grid<T> {
self.scroll_limit = min(self.scroll_limit + count, self.raw.len() - *self.lines);
}
+ fn decrease_scroll_limit(&mut self, count: usize) {
+ self.scroll_limit = self.scroll_limit.saturating_sub(count);
+ }
+
/// Add lines to the visible area
///
/// The behavior in Terminal.app and iTerm.app is to keep the cursor at the
@@ -236,17 +240,16 @@ impl<T: Copy + Clone> Grid<T> {
// active, the bottom lines are restored in the next step.
self.raw.rotate_up(*positions);
+ self.decrease_scroll_limit(*positions);
+
// Now, restore any scroll region lines
let lines = self.lines;
for i in IndexRange(region.end .. lines) {
- // First do the swap
- // TODO there is a bug here causing a panic.
- // TODO math
self.raw.swap_lines(i, i + positions);
}
// Finally, reset recycled lines
- for i in 0..*positions {
+ for i in IndexRange(Line(0)..positions) {
self.raw[i].reset(&self.template_row);
}
} else {