summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tty.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/tty.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/tty.c')
-rw-r--r--usr.bin/tmux/tty.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 4b2be318a9c..d1a858ee191 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.347 2020/04/09 12:16:16 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.348 2020/04/16 13:35:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1426,6 +1426,20 @@ tty_draw_line(struct tty *tty, struct window_pane *wp, struct screen *s,
tty_update_mode(tty, tty->mode, s);
}
+void
+tty_sync_start(struct tty *tty)
+{
+ if ((tty->term->flags|tty->term_flags) & TERM_SYNC)
+ tty_puts(tty, "\033P=1s\033\\");
+}
+
+void
+tty_sync_end(struct tty *tty)
+{
+ if ((tty->term->flags|tty->term_flags) & TERM_SYNC)
+ tty_puts(tty, "\033P=2s\033\\");
+}
+
static int
tty_client_ready(struct client *c, struct window_pane *wp)
{
@@ -1919,6 +1933,18 @@ tty_cmd_rawstring(struct tty *tty, const struct tty_ctx *ctx)
tty_invalidate(tty);
}
+void
+tty_cmd_syncstart(struct tty *tty, __unused const struct tty_ctx *ctx)
+{
+ tty_sync_start(tty);
+}
+
+void
+tty_cmd_syncend(struct tty *tty, __unused const struct tty_ctx *ctx)
+{
+ tty_sync_end(tty);
+}
+
static void
tty_cell(struct tty *tty, const struct grid_cell *gc, struct window_pane *wp)
{