diff options
author | Joe Wilm <joe@jwilm.com> | 2017-04-30 21:32:11 -0700 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-05-01 08:21:42 -0700 |
commit | 9c557407d6eb49d247ca1206660b4c3af64a6e7f (patch) | |
tree | f2d716dab48ee49f16ea1a268099ba2fd100c8e1 /src/term | |
parent | 7d20d29f3742115c2228f2d1a3b6c7b2f6da20c0 (diff) | |
download | alacritty-9c557407d6eb49d247ca1206660b4c3af64a6e7f.tar.gz alacritty-9c557407d6eb49d247ca1206660b4c3af64a6e7f.zip |
Add limit check in scroll_up/down_relative
Diffstat (limited to 'src/term')
-rw-r--r-- | src/term/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index 191a1e04..ecf12265 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -960,7 +960,8 @@ impl Term { /// Expects origin to be in scroll range. #[inline] fn scroll_down_relative(&mut self, origin: Line, lines: Line) { - trace!("scroll_down: {}", lines); + trace!("scroll_down_relative: origin={}, lines={}", origin, lines); + let lines = min(lines, self.scroll_region.end - self.scroll_region.start); // Copy of cell template; can't have it borrowed when calling clear/scroll let template = self.empty_cell; @@ -981,7 +982,8 @@ impl Term { /// Expects origin to be in scroll range. #[inline] fn scroll_up_relative(&mut self, origin: Line, lines: Line) { - trace!("scroll_up: {}", lines); + trace!("scroll_up_relative: origin={}, lines={}", origin, lines); + let lines = min(lines, self.scroll_region.end - self.scroll_region.start); // Copy of cell template; can't have it borrowed when calling clear/scroll let template = self.empty_cell; |