diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-04-25 21:52:25 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-04-25 21:52:25 -0400 |
commit | 4b4622f260eb6c051404bd04395752e774d30c6c (patch) | |
tree | 3ea39f1fdf98776b19826c6d801ab919d4800a20 | |
parent | 331891d3a2ed706bc0d9fb095f6f90db91e0ed20 (diff) | |
download | runes-4b4622f260eb6c051404bd04395752e774d30c6c.tar.gz runes-4b4622f260eb6c051404bd04395752e774d30c6c.zip |
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
-rw-r--r-- | src/window-xlib.c | 11 |
1 files 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); } |