Skip to content

Commit

Permalink
Add limit check in scroll_up/down_relative
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilm committed May 1, 2017
1 parent 7d20d29 commit 9c55740
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/term/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 9c55740

Please sign in to comment.