From 135bb1edeeab3faae8001100aa7c173be9aa91e1 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 20 Apr 2020 13:38:48 +0000 Subject: [PATCH] Change the Sync capability to be a string instead of a flag. --- tmux.1 | 2 +- tty-features.c | 3 +-- tty-term.c | 2 +- tty.c | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tmux.1 b/tmux.1 index ca4e30e0..648aed4d 100644 --- a/tmux.1 +++ b/tmux.1 @@ -5572,7 +5572,7 @@ If .Em Se is not set, \&Ss with argument 0 will be used to reset the cursor style instead. .It Em \&Sync -Show that the terminal supports synchronized updates. +Start (parameter is 1) or end (parameter is 2) a synchronized update. .It Em \&Tc Indicate that the terminal supports the .Ql direct colour diff --git a/tty-features.c b/tty-features.c index 58cbae7b..b6934673 100644 --- a/tty-features.c +++ b/tty-features.c @@ -35,7 +35,6 @@ * Also: * - XT is used to decide whether to send DA and DSR, * - DECSLRM and DECFRA use a flag instead of capabilities. - * - Sync is a flag rather than a string capability. * - UTF-8 is a separate flag on the client; needed for unattached clients. */ @@ -148,7 +147,7 @@ static struct tty_feature tty_feature_ccolour = { /* Terminal supports synchronized updates. */ static const char *tty_feature_sync_capabilities[] = { - "Sync", + "Sync=\\EP=%p1%ds\\E\\\\", NULL }; static struct tty_feature tty_feature_sync = { diff --git a/tty-term.c b/tty-term.c index 1c87ac15..e1b026ea 100644 --- a/tty-term.c +++ b/tty-term.c @@ -259,7 +259,7 @@ static const struct tty_term_code_entry tty_term_codes[] = { [TTYC_SMUL] = { TTYCODE_STRING, "smul" }, [TTYC_SMXX] = { TTYCODE_STRING, "smxx" }, [TTYC_SS] = { TTYCODE_STRING, "Ss" }, - [TTYC_SYNC] = { TTYCODE_FLAG, "Sync" }, + [TTYC_SYNC] = { TTYCODE_STRING, "Sync" }, [TTYC_TC] = { TTYCODE_FLAG, "Tc" }, [TTYC_TSL] = { TTYCODE_STRING, "tsl" }, [TTYC_U8] = { TTYCODE_NUMBER, "U8" }, diff --git a/tty.c b/tty.c index dfc35873..e1c629ec 100644 --- a/tty.c +++ b/tty.c @@ -1428,7 +1428,7 @@ void tty_sync_start(struct tty *tty) { if ((~tty->flags & TTY_SYNCING) && tty_term_has(tty->term, TTYC_SYNC)) { - tty_puts(tty, "\033P=1s\033\\"); + tty_putcode1(tty, TTYC_SYNC, 1); tty->flags |= TTY_SYNCING; } } @@ -1437,7 +1437,7 @@ void tty_sync_end(struct tty *tty) { if ((tty->flags & TTY_SYNCING) && tty_term_has(tty->term, TTYC_SYNC)) { - tty_puts(tty, "\033P=2s\033\\"); + tty_putcode1(tty, TTYC_SYNC, 2); tty->flags &= ~TTY_SYNCING; } }