diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-09-16 11:43:48 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-09-16 11:45:14 -0400 |
commit | d469943454fc36add1ea6dd78d6fc4d963753761 (patch) | |
tree | f82e4b13c5aa0982ff3b53af9272a97f27130fcf | |
parent | 9412ba117c5b13abd5b2467192ef48873bedd393 (diff) | |
download | libvt100-d469943454fc36add1ea6dd78d6fc4d963753761.tar.gz libvt100-d469943454fc36add1ea6dd78d6fc4d963753761.zip |
writing over the second half of a wide character should clear it
-rw-r--r-- | src/screen.c | 32 |
1 files 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) |