aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2016-05-03 01:51:33 -0400
committerJesse Luehrs <doy@tozt.net>2016-05-03 01:51:33 -0400
commitb5a2063c6cb62860ad0070b1ff41cff1ef6ab231 (patch)
treed7b8129e8af9fc84a815ab9bbe8ca6077487cd28
parent853537d7813125fbd0a1e1167ab40ce5bc8b99eb (diff)
downloadrunes-b5a2063c6cb62860ad0070b1ff41cff1ef6ab231.tar.gz
runes-b5a2063c6cb62860ad0070b1ff41cff1ef6ab231.zip
display the cursor for wide characters properly
-rw-r--r--src/display.c15
1 files 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,