From 4b4622f260eb6c051404bd04395752e774d30c6c Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 25 Apr 2014 21:52:25 -0400 Subject: don't draw the cursor off the screen the cursor column can be one past the end of the row if a glyph was drawn in the last column and then nothing else happened --- src/window-xlib.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/window-xlib.c b/src/window-xlib.c index 9b97c43..375e595 100644 --- a/src/window-xlib.c +++ b/src/window-xlib.c @@ -528,21 +528,26 @@ static void runes_window_backend_audible_bell(RunesTerm *t) static void runes_window_backend_draw_cursor(RunesTerm *t) { if (!t->scr.hide_cursor) { + int row = t->scr.cur.row, col = t->scr.cur.col; + + if (col >= t->scr.max.col) { + col = t->scr.max.col - 1; + } + cairo_save(t->backend_cr); cairo_set_source(t->backend_cr, t->cursorcolor); if (t->unfocused) { cairo_set_line_width(t->backend_cr, 1); cairo_rectangle( t->backend_cr, - t->scr.cur.col * t->fontx + 0.5, - t->scr.cur.row * t->fonty + 0.5, + col * t->fontx + 0.5, row * t->fonty + 0.5, t->fontx, t->fonty); cairo_stroke(t->backend_cr); } else { cairo_rectangle( t->backend_cr, - t->scr.cur.col * t->fontx, t->scr.cur.row * t->fonty, + col * t->fontx, row * t->fonty, t->fontx, t->fonty); cairo_fill(t->backend_cr); } -- cgit v1.2.3-54-g00ecf