=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/screen-write.c,v retrieving revision 1.130 retrieving revision 1.131 diff -u -r1.130 -r1.131 --- src/usr.bin/tmux/screen-write.c 2017/08/09 11:43:45 1.130 +++ src/usr.bin/tmux/screen-write.c 2017/10/05 08:12:24 1.131 @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.130 2017/08/09 11:43:45 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.131 2017/10/05 08:12:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1243,6 +1243,7 @@ struct screen *s = ctx->s; struct screen_write_collect_item *ci = ctx->item; struct grid_cell gc; + u_int xx; if (ci->used == 0) return; @@ -1255,9 +1256,27 @@ log_debug("%s: %u %s (at %u,%u)", __func__, ci->used, ci->data, s->cx, s->cy); + if (s->cx != 0) { + for (xx = s->cx; xx > 0; xx--) { + grid_view_get_cell(s->grid, xx, s->cy, &gc); + if (~gc.flags & GRID_FLAG_PADDING) + break; + grid_view_set_cell(s->grid, xx, s->cy, &grid_default_cell); + } + if (gc.data.width > 1) + grid_view_set_cell(s->grid, xx, s->cy, &grid_default_cell); + } + memcpy(&gc, &ci->gc, sizeof gc); grid_view_set_cells(s->grid, s->cx, s->cy, &gc, ci->data, ci->used); s->cx += ci->used; + + for (xx = s->cx; xx < screen_size_x(s); xx++) { + grid_view_get_cell(s->grid, xx, s->cy, &gc); + if (~gc.flags & GRID_FLAG_PADDING) + break; + grid_view_set_cell(s->grid, xx, s->cy, &grid_default_cell); + } } /* Write cell data, collecting if necessary. */ @@ -1388,6 +1407,7 @@ * already ensured there is enough room. */ for (xx = s->cx + 1; xx < s->cx + width; xx++) { + log_debug("%s: new padding at %u,%u", __func__, xx, s->cy); grid_view_set_cell(gd, xx, s->cy, &screen_write_pad_cell); skip = 0; } @@ -1537,10 +1557,12 @@ grid_view_get_cell(gd, xx, s->cy, &tmp_gc); if (~tmp_gc.flags & GRID_FLAG_PADDING) break; + log_debug("%s: padding at %u,%u", __func__, xx, s->cy); grid_view_set_cell(gd, xx, s->cy, &grid_default_cell); } /* Overwrite the character at the start of this padding. */ + log_debug("%s: character at %u,%u", __func__, xx, s->cy); grid_view_set_cell(gd, xx, s->cy, &grid_default_cell); done = 1; } @@ -1557,6 +1579,7 @@ grid_view_get_cell(gd, xx, s->cy, &tmp_gc); if (~tmp_gc.flags & GRID_FLAG_PADDING) break; + log_debug("%s: overwrite at %u,%u", __func__, xx, s->cy); grid_view_set_cell(gd, xx, s->cy, &grid_default_cell); done = 1; }