aboutsummaryrefslogtreecommitdiff
path: root/tty.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 /tty.c
parenta2e47b527986af6140a9dfa43c9448347dc0a050 (diff)
downloadrtmux-b2443aa2f98c1a1fa5d53d4e79a3e7fd221cc365.tar.gz
rtmux-b2443aa2f98c1a1fa5d53d4e79a3e7fd221cc365.tar.bz2
rtmux-b2443aa2f98c1a1fa5d53d4e79a3e7fd221cc365.zip
Add support for the iTerm2 sychronized updates escape sequence which
drastically reduces flickering.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tty.c b/tty.c
index a7607cba..95c16fb8 100644
--- a/tty.c
+++ b/tty.c
@@ -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)
{