From d469943454fc36add1ea6dd78d6fc4d963753761 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 16 Sep 2014 11:43:48 -0400 Subject: writing over the second half of a wide character should clear it --- src/screen.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/screen.c b/src/screen.c index 66cac51..c2acc43 100644 --- a/src/screen.c +++ b/src/screen.c @@ -205,6 +205,20 @@ void vt100_screen_show_string_ascii(VT100Screen *vt, char *buf, size_t len) size_t i; int col = vt->grid->cur.col; + if (len) { + vt->dirty = 1; + + if (col > 0) { + struct vt100_cell *cell; + + cell = vt100_screen_cell_at(vt, vt->grid->cur.row, col - 1); + if (cell->is_wide) { + cell->len = 1; + cell->contents[0] = ' '; + } + } + } + for (i = 0; i < len; ++i) { struct vt100_cell *cell; @@ -221,8 +235,6 @@ void vt100_screen_show_string_ascii(VT100Screen *vt, char *buf, size_t len) cell->is_wide = 0; } vt100_screen_move_to(vt, vt->grid->cur.row, col); - - vt->dirty = 1; } void vt100_screen_show_string_utf8(VT100Screen *vt, char *buf, size_t len) @@ -230,6 +242,20 @@ void vt100_screen_show_string_utf8(VT100Screen *vt, char *buf, size_t len) char *c = buf, *next; int col = vt->grid->cur.col; + if (len) { + vt->dirty = 1; + + if (col > 0) { + struct vt100_cell *cell; + + cell = vt100_screen_cell_at(vt, vt->grid->cur.row, col - 1); + if (cell->is_wide) { + cell->len = 1; + cell->contents[0] = ' '; + } + } + } + /* XXX need to detect combining characters and append them to the previous * cell */ while ((next = g_utf8_next_char(c))) { @@ -293,8 +319,6 @@ void vt100_screen_show_string_utf8(VT100Screen *vt, char *buf, size_t len) } } vt100_screen_move_to(vt, vt->grid->cur.row, col); - - vt->dirty = 1; } void vt100_screen_move_to(VT100Screen *vt, int row, int col) -- cgit v1.2.3