aboutsummaryrefslogtreecommitdiff
path: root/src/term.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-09-16 17:12:53 -0700
committerJoe Wilm <joe@jwilm.com>2016-09-16 17:12:53 -0700
commit7da9de34d81f6a03f1923ff95ce0f48678ce86fb (patch)
treeb61a9412acb549e1b6dffd50c98e064410e5bce1 /src/term.rs
parentc5bc39fe263466986aff622d26d5c93f2f5da0ff (diff)
downloadr-alacritty-7da9de34d81f6a03f1923ff95ce0f48678ce86fb.tar.gz
r-alacritty-7da9de34d81f6a03f1923ff95ce0f48678ce86fb.tar.bz2
r-alacritty-7da9de34d81f6a03f1923ff95ce0f48678ce86fb.zip
Fix crash
There might be a better way to track cursor state such that these checks aren't necessary.
Diffstat (limited to 'src/term.rs')
-rw-r--r--src/term.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/term.rs b/src/term.rs
index 45e3cf75..0cb54240 100644
--- a/src/term.rs
+++ b/src/term.rs
@@ -36,7 +36,7 @@ pub struct RenderGrid<'a> {
impl<'a> RenderGrid<'a> {
fn new<'b>(grid: &'b mut Grid<Cell>, cursor: &'b Cursor, mode: TermMode) -> RenderGrid<'b> {
- if mode.contains(mode::SHOW_CURSOR) {
+ if mode.contains(mode::SHOW_CURSOR) && grid.contains(cursor) {
let cell = &mut grid[cursor];
mem::swap(&mut cell.fg, &mut cell.bg);
}
@@ -51,7 +51,7 @@ impl<'a> RenderGrid<'a> {
impl<'a> Drop for RenderGrid<'a> {
fn drop(&mut self) {
- if self.mode.contains(mode::SHOW_CURSOR) {
+ if self.mode.contains(mode::SHOW_CURSOR) && self.inner.contains(self.cursor) {
let cell = &mut self.inner[self.cursor];
mem::swap(&mut cell.fg, &mut cell.bg);
}