From 8f064369859947fd039531c8e3239fe37656eac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 19 Mar 2022 20:04:11 +0100 Subject: [PATCH] dcs: map BSU/ESU unhook handlers directly to term_{enable,disable}_app_sync_upates() That is, drop the local bsu() and esu() functions. --- dcs.c | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/dcs.c b/dcs.c index dbd4ead2..a5feb387 100644 --- a/dcs.c +++ b/dcs.c @@ -10,30 +10,6 @@ #include "vt.h" #include "xmalloc.h" -static void -bsu(struct terminal *term) -{ - /* https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec */ - - size_t n = term->vt.dcs.idx; - if (unlikely(n > 0)) - LOG_DBG("BSU with unknown params: %.*s)", (int)n, term->vt.dcs.data); - - term_enable_app_sync_updates(term); -} - -static void -esu(struct terminal *term) -{ - /* https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec */ - - size_t n = term->vt.dcs.idx; - if (unlikely(n > 0)) - LOG_DBG("ESU with unknown params: %.*s)", (int)n, term->vt.dcs.data); - - term_disable_app_sync_updates(term); -} - /* Decode hex-encoded string *inline*. NULL terminates */ static char * hex_decode(const char *s, size_t len) @@ -419,9 +395,14 @@ dcs_hook(struct terminal *term, uint8_t final) case '=': switch (final) { case 's': + /* BSU/ESU: https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec */ switch (vt_param_get(term, 0, 0)) { - case 1: term->vt.dcs.unhook_handler = &bsu; return; - case 2: term->vt.dcs.unhook_handler = &esu; return; + case 1: + term->vt.dcs.unhook_handler = &term_enable_app_sync_updates; + return; + case 2: + term->vt.dcs.unhook_handler = &term_disable_app_sync_updates; + return; } break; }