aboutsummaryrefslogtreecommitdiff
path: root/screen-write.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2016-10-13 08:09:47 +0100
committerThomas Adam <thomas@xteddy.org>2016-10-13 08:09:47 +0100
commit6551f4bb3b651aa2dba77a98cc42828737b88306 (patch)
tree82dd6cbba583e9d4bc58a9334a8b74713d94da89 /screen-write.c
parent76a9e6f27bb0c7b547989c3b80cf8cc0a148064d (diff)
parente0add119ea4a6c8d40905a7ad1f7bc3553d20ccc (diff)
downloadrtmux-6551f4bb3b651aa2dba77a98cc42828737b88306.tar.gz
rtmux-6551f4bb3b651aa2dba77a98cc42828737b88306.tar.bz2
rtmux-6551f4bb3b651aa2dba77a98cc42828737b88306.zip
Merge branch 'obsd-master'
Conflicts: paste.c
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/screen-write.c b/screen-write.c
index 3a1fc8c8..8156a1d0 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -103,6 +103,7 @@ screen_write_flush(struct screen_write_ctx *ctx)
if (ctx->dirty == 0)
return;
dirty = 0;
+ log_debug("%s: dirty %u", __func__, ctx->dirty);
cx = s->cx;
cy = s->cy;
@@ -1044,9 +1045,12 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
screen_write_initctx(ctx, &ttyctx);
/* If in insert mode, make space for the cells. */
- if ((s->mode & MODE_INSERT) && s->cx <= sx - width) {
- xx = sx - s->cx - width;
- grid_move_cells(s->grid, s->cx + width, s->cx, s->cy, xx);
+ if (s->mode & MODE_INSERT) {
+ if (s->cx <= sx - width) {
+ screen_write_flush(ctx);
+ xx = sx - s->cx - width;
+ grid_view_insert_cells(s->grid, s->cx, s->cy, xx);
+ }
insert = 1;
} else
insert = 0;
@@ -1133,20 +1137,14 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
/* Create space for character in insert mode. */
if (insert) {
- if (!wrapped)
- screen_write_flush(ctx);
ttyctx.num = width;
tty_write(tty_cmd_insertcharacter, &ttyctx);
}
/* Write to the screen. */
if (selected) {
- memcpy(&tmp_gc, &s->sel.cell, sizeof tmp_gc);
- utf8_copy(&tmp_gc.data, &gc->data);
- tmp_gc.attr = tmp_gc.attr & ~GRID_ATTR_CHARSET;
- tmp_gc.attr |= gc->attr & GRID_ATTR_CHARSET;
- tmp_gc.flags = gc->flags;
screen_write_flush(ctx);
+ screen_select_cell(s, &tmp_gc, gc);
ttyctx.cell = &tmp_gc;
tty_write(tty_cmd_cell, &ttyctx);
ctx->written++;