diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-07-27 11:33:21 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-07-27 11:33:21 +0000 |
commit | fc65da1eed07708030c0ae491cb8f4a6614de390 (patch) | |
tree | b194e1d04ac3b5a42ff1e1b992f27cfaaee0bdd6 /screen-write.c | |
parent | 584eda83397b262be01bddff31040e5cf4ff01a1 (diff) |
Draw UTF-8 characters under the selection correctly.
Diffstat (limited to 'screen-write.c')
-rw-r--r-- | screen-write.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/screen-write.c b/screen-write.c index e2fbfbf4..449c3a35 100644 --- a/screen-write.c +++ b/screen-write.c @@ -723,7 +723,7 @@ screen_write_cell( struct tty_ctx ttyctx; struct grid_utf8 gu, *tmp_gu; u_int width, xx, i; - struct grid_cell tmp_gc, *tmp_gc2; + struct grid_cell tmp_gc, tmp_gc2, *tmp_gcp; int insert = 0; /* Ignore padding. */ @@ -743,11 +743,11 @@ screen_write_cell( if (width == 0) { if (s->cx == 0) return; - tmp_gc2 = grid_view_get_cell(gd, s->cx - 1, s->cy); - if (!(tmp_gc2->flags & GRID_FLAG_UTF8)) { - tmp_gc2->flags |= GRID_FLAG_UTF8; + tmp_gcp = grid_view_get_cell(gd, s->cx - 1, s->cy); + if (!(tmp_gcp->flags & GRID_FLAG_UTF8)) { + tmp_gcp->flags |= GRID_FLAG_UTF8; memset(&gu.data, 0xff, sizeof gu.data); - *gu.data = tmp_gc2->data; + *gu.data = tmp_gcp->data; gu.width = 1; grid_view_set_utf8(gd, s->cx - 1, s->cy, &gu); } @@ -799,9 +799,9 @@ screen_write_cell( * already ensured there is enough room. */ for (xx = s->cx + 1; xx < s->cx + width; xx++) { - tmp_gc2 = grid_view_get_cell(gd, xx, s->cy); - if (tmp_gc2 != NULL) - tmp_gc2->flags |= GRID_FLAG_PADDING; + tmp_gcp = grid_view_get_cell(gd, xx, s->cy); + if (tmp_gcp != NULL) + tmp_gcp->flags |= GRID_FLAG_PADDING; } /* Set the cell. */ @@ -820,8 +820,10 @@ screen_write_cell( } ttyctx.utf8 = &gu; if (screen_check_selection(s, s->cx - width, s->cy)) { - s->sel.cell.data = gc->data; - ttyctx.cell = &s->sel.cell; + memcpy(&tmp_gc2, &s->sel.cell, sizeof tmp_gc2); + tmp_gc2.data = gc->data; + tmp_gc2.flags = gc->flags; + ttyctx.cell = &tmp_gc2; tty_write(tty_cmd_cell, &ttyctx); } else { ttyctx.cell = gc; |