summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2016-10-12 15:43:52 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2016-10-12 15:43:52 +0000
commita0fa3f5336f0fd990832a1c52739d1bcc0fa0d1c (patch)
tree057222cc9ee33dc50e34f06d9d77024851f05b90 /usr.bin
parenta688cb2f55dc003c7168098adf451fcc265a7b1c (diff)
Fix a couple of problems with insert mode: flush dirty cells before we
modify the screen, not after; and use grid_view_insert_cells to make space not grid_move_cells.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/screen-write.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c
index 71871b6eda8..dea56fa3e96 100644
--- a/usr.bin/tmux/screen-write.c
+++ b/usr.bin/tmux/screen-write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen-write.c,v 1.97 2016/10/12 13:24:07 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.98 2016/10/12 15:43:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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,8 +1137,6 @@ 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);
}