diff options
author | 2016-10-12 15:43:51 +0000 | |
---|---|---|
committer | 2016-10-12 15:43:51 +0000 | |
commit | 8368ee61e869e69329c8eb31356c1219f792713c (patch) | |
tree | d5846b0a7a6c5a8458dbf46beb0fe19c90fbbf91 | |
parent | bind-key -c has gone, remove from man page, and unused table declarations. (diff) | |
download | wireguard-openbsd-8368ee61e869e69329c8eb31356c1219f792713c.tar.xz wireguard-openbsd-8368ee61e869e69329c8eb31356c1219f792713c.zip |
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.
-rw-r--r-- | usr.bin/tmux/screen-write.c | 14 |
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); } |