aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Wilm <jwilm@users.noreply.github.com>2017-01-06 13:02:11 -0800
committerGitHub <noreply@github.com>2017-01-06 13:02:11 -0800
commit8d8fca6b039cb8b8b6481658cbb8dc978a580c2f (patch)
tree81eb83dbec790554e319f25d8db986959cfa37a1
parenta61e000f989bde05b4a26e88334c30063dc8e6cf (diff)
parent4fad82bc267141532460d6fc15b1ee6c1acd9589 (diff)
downloadalacritty-8d8fca6b039cb8b8b6481658cbb8dc978a580c2f.tar.gz
alacritty-8d8fca6b039cb8b8b6481658cbb8dc978a580c2f.zip
Merge pull request #91 from coder543/master
Fix crash when exiting `top`
-rw-r--r--src/term/mod.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index c93ec963..690c2f10 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -643,9 +643,10 @@ impl ansi::Handler for Term {
#[inline]
fn goto(&mut self, line: Line, col: Column) {
+ use std::cmp::min;
debug_println!("goto: line={}, col={}", line, col);
- self.cursor.line = line;
- self.cursor.col = col;
+ self.cursor.line = min(line, self.grid.num_lines() - 1);
+ self.cursor.col = min(col, self.grid.num_cols() - 1);
}
#[inline]