From b5a2063c6cb62860ad0070b1ff41cff1ef6ab231 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 3 May 2016 01:51:33 -0400 Subject: display the cursor for wide characters properly --- src/display.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/display.c b/src/display.c index 167605d..8cff223 100644 --- a/src/display.c +++ b/src/display.c @@ -111,12 +111,19 @@ void runes_display_draw_cursor(RunesTerm *t, cairo_t *cr) RunesDisplay *display = &t->display; if (!t->scr.hide_cursor) { - int row = t->scr.grid->cur.row, col = t->scr.grid->cur.col; + int row = t->scr.grid->cur.row, col = t->scr.grid->cur.col, width; + struct vt100_cell *cell; if (col >= t->scr.grid->max.col) { col = t->scr.grid->max.col - 1; } + cell = &t->scr.grid->rows[t->scr.grid->row_top + row].cells[col]; + width = display->fontx; + if (cell->is_wide) { + width *= 2; + } + cairo_save(cr); cairo_set_source(cr, t->config.cursorcolor); if (display->unfocused) { @@ -125,17 +132,15 @@ void runes_display_draw_cursor(RunesTerm *t, cairo_t *cr) cr, col * display->fontx + 0.5, (row + display->row_visible_offset) * display->fonty + 0.5, - display->fontx - 1, display->fonty - 1); + width - 1, display->fonty - 1); cairo_stroke(cr); } else { - struct vt100_cell *cell = &t->scr.grid->rows[t->scr.grid->row_top + row].cells[col]; - cairo_rectangle( cr, col * display->fontx, (row + display->row_visible_offset) * display->fonty, - display->fontx, display->fonty); + width, display->fonty); cairo_fill(cr); runes_display_draw_glyph( t, cr, t->config.bgdefault, cell->attrs, -- cgit v1.2.3