aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-02-03 19:42:25 -0800
committerJoe Wilm <jwilm@users.noreply.github.com>2017-02-03 20:01:13 -0800
commit82c9235bb194b7f535ed46516d793a96a0d30bf4 (patch)
treed135464ccc4f9a2b74eb674f2ce6e554549d21b5
parent8f2e7b08a6431288d3e612c95bb1a226cc92ab82 (diff)
downloadalacritty-82c9235bb194b7f535ed46516d793a96a0d30bf4.tar.gz
alacritty-82c9235bb194b7f535ed46516d793a96a0d30bf4.zip
Fix bug with restore cursor
The saved cursor position could previously end up outside of the grid if the terminal was resized to be smaller and then calling a restore. Restore now ensures the cursor line and column are within grid bounds.
-rw-r--r--src/term/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index e4c64fa5..633aa904 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -1086,6 +1086,8 @@ impl ansi::Handler for Term {
};
self.cursor = *holder;
+ self.cursor.point.line = min(self.cursor.point.line, self.grid.num_lines() - 1);
+ self.cursor.point.col = min(self.cursor.point.col, self.grid.num_cols() - 1);
}
#[inline]