From b2443aa2f98c1a1fa5d53d4e79a3e7fd221cc365 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 16 Apr 2020 13:35:24 +0000 Subject: Add support for the iTerm2 sychronized updates escape sequence which drastically reduces flickering. --- screen-write.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'screen-write.c') 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 */ } -- cgit v1.2.3