diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-04-27 01:34:05 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-04-27 01:34:05 -0400 |
commit | 40280ca16718984c2d9dc5786a69be82a8a9f259 (patch) | |
tree | 14814075dd53490c4b845f55414df3f924b995b0 | |
parent | 7a16ef702689181492f773ac0211e200f33a8061 (diff) | |
download | runes-40280ca16718984c2d9dc5786a69be82a8a9f259.tar.gz runes-40280ca16718984c2d9dc5786a69be82a8a9f259.zip |
handle combining characters when the line has wrapped
-rw-r--r-- | src/screen.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/screen.c b/src/screen.c index 4607322..429b057 100644 --- a/src/screen.c +++ b/src/screen.c @@ -84,7 +84,7 @@ void runes_screen_show_string_utf8(RunesTerm *t, char *buf, size_t len) * cell */ while ((next = g_utf8_next_char(c))) { gunichar uc; - struct runes_cell *cell; + struct runes_cell *cell = NULL; int is_wide, is_combining; GUnicodeType ctype; @@ -97,9 +97,14 @@ void runes_screen_show_string_utf8(RunesTerm *t, char *buf, size_t len) || ctype == G_UNICODE_NON_SPACING_MARK; if (is_combining) { - /* XXX this should also check the previous line if it wrapped */ if (scr->cur.col > 0) { cell = &scr->rows[scr->cur.row].cells[scr->cur.col - 1]; + } + else if (scr->cur.row > 0 && scr->rows[scr->cur.row - 1].wrapped) { + cell = &scr->rows[scr->cur.row - 1].cells[scr->max.col - 1]; + } + + if (cell) { memcpy(cell->contents + cell->len, c, next - c); cell->len += next - c; } |