diff options
author | nicm <nicm> | 2016-10-12 15:43:51 +0000 |
---|---|---|
committer | nicm <nicm> | 2016-10-12 15:43:51 +0000 |
commit | e83ebf50de7503b96203df9a4b2badf2c649b031 (patch) | |
tree | 5200336e3ca9c250b0b4c1b718981280ed089f54 /screen-write.c | |
parent | 40253048ca6d6ecf45be24a76220d6012aca9818 (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 'screen-write.c')
-rw-r--r-- | screen-write.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/screen-write.c b/screen-write.c index 1767d9bb..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,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); } |