summaryrefslogtreecommitdiffstats
path: root/screen-write.c
diff options
context:
space:
mode:
authornicm <nicm>2020-04-16 13:35:24 +0000
committernicm <nicm>2020-04-16 13:35:24 +0000
commitb2443aa2f98c1a1fa5d53d4e79a3e7fd221cc365 (patch)
tree3cc90dfb69ef9c9c6c340639196da2815e9cf4de /screen-write.c
parenta2e47b527986af6140a9dfa43c9448347dc0a050 (diff)
Add support for the iTerm2 sychronized updates escape sequence which
drastically reduces flickering.
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/screen-write.c b/screen-write.c
index b2f9e223..3e7fa66b 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -100,7 +100,8 @@ void
screen_write_start(struct screen_write_ctx *ctx, struct window_pane *wp,
struct screen *s)
{
- u_int y;
+ struct tty_ctx ttyctx;
+ u_int y;
memset(ctx, 0, sizeof *ctx);
@@ -129,18 +130,26 @@ screen_write_start(struct screen_write_ctx *ctx, struct window_pane *wp,
screen_size_y(ctx->s));
}
}
+
+ screen_write_initctx(ctx, &ttyctx);
+ tty_write(tty_cmd_syncstart, &ttyctx);
}
/* Finish writing. */
void
screen_write_stop(struct screen_write_ctx *ctx)
{
+ struct tty_ctx ttyctx;
+
screen_write_collect_end(ctx);
screen_write_collect_flush(ctx, 0);
log_debug("%s: %u cells (%u written, %u skipped)", __func__,
ctx->cells, ctx->written, ctx->skipped);
+ screen_write_initctx(ctx, &ttyctx);
+ tty_write(tty_cmd_syncend, &ttyctx);
+
free(ctx->item);
free(ctx->list); /* flush will have emptied */
}