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-06-02 09:32:29 -0700
commit54d50ed3be810861d3c2fa500c3fcc8e802198d9 (patch)
treea09b08415147169b89c7a01c768041eb6424bf93 /src/grid/mod.rs
parentc49a7e88f64d1421474d492cc6f51bfd30e1e4d1 (diff)
downloadr-alacritty-54d50ed3be810861d3c2fa500c3fcc8e802198d9.tar.gz
r-alacritty-54d50ed3be810861d3c2fa500c3fcc8e802198d9.tar.bz2
r-alacritty-54d50ed3be810861d3c2fa500c3fcc8e802198d9.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 {