diff options
Diffstat (limited to 'src/ui/grid/grid.rs')
-rw-r--r-- | src/ui/grid/grid.rs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/ui/grid/grid.rs b/src/ui/grid/grid.rs index 3cf563e..a698cbb 100644 --- a/src/ui/grid/grid.rs +++ b/src/ui/grid/grid.rs @@ -118,22 +118,24 @@ impl Grid { // cairo context. if ctx.cursor_blink_on == 0 { if let Some(row) = ctx.rows.get(ctx.cursor.0 as usize) { - let cell = row.cell_at(ctx.cursor.1 as usize); - render::cursor_cell( - &ctx.cursor_context, - &self.da.get_pango_context().unwrap(), - &cell, - &ctx.cell_metrics, - hl_defs, - ); + if let Some(cell) = row.cell_at(ctx.cursor.1 as usize) { + render::cursor_cell( + &ctx.cursor_context, + &self.da.get_pango_context().unwrap(), + &cell, + &ctx.cell_metrics, + hl_defs, + ); + } } } // Update cursor color. if let Some(row) = ctx.rows.get(ctx.cursor.0 as usize) { - let cell = row.cell_at(ctx.cursor.1 as usize); - let hl = hl_defs.get(&cell.hl_id).unwrap(); - ctx.cursor_color = hl.foreground.unwrap_or(hl_defs.default_fg); + if let Some(cell) = row.cell_at(ctx.cursor.1 as usize) { + let hl = hl_defs.get(&cell.hl_id).unwrap(); + ctx.cursor_color = hl.foreground.unwrap_or(hl_defs.default_fg); + } } while let Some(area) = ctx.queue_draw_area.pop() { |