summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/screen-write.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-04-16 13:35:24 +0000
committernicm <nicm@openbsd.org>2020-04-16 13:35:24 +0000
commit76b45294daa0697c38f5d4cf0dbca272258fa195 (patch)
treeb4012a15f4f226be43923faddfeb7775fc1339db /usr.bin/tmux/screen-write.c
parentMake parse_unit return signed int (diff)
downloadwireguard-openbsd-76b45294daa0697c38f5d4cf0dbca272258fa195.tar.xz
wireguard-openbsd-76b45294daa0697c38f5d4cf0dbca272258fa195.zip
Add support for the iTerm2 sychronized updates escape sequence which
drastically reduces flickering.
Diffstat (limited to 'usr.bin/tmux/screen-write.c')
-rw-r--r--usr.bin/tmux/screen-write.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c
index b065f27a024..a084d170efb 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.161 2020/04/15 16:11:23 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.162 2020/04/16 13:35:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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 */
}