From 057a28ac155665e33678d95f620a614c0223c5b2 Mon Sep 17 00:00:00 2001 From: Stephen Hurd Date: Mon, 25 Dec 2023 06:19:18 -0500 Subject: [PATCH 1/2] Enable detecting SyncTERM DA1 response. SyncTERM sends CSI = Pn c not CSI ? Pn c like VT terminals. This results in notcurses hanging in init. This required WezTerm da3 support to be removed, because the SyncTERM and WezTerm responses could not both exist in the automaton. As it turns out, a dig through the WezTerm git history shows that it never actually sent CSI = ... ST in response to DA3, and notcurses took no actions in response to it, so it should be safe to remove this feature. --- src/lib/in.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/lib/in.c b/src/lib/in.c index b6d4c79ef..bdcca2199 100644 --- a/src/lib/in.c +++ b/src/lib/in.c @@ -1221,6 +1221,22 @@ scrub_sixel_responses(struct initial_responses* idata){ } } +// Most annoyingly, SyncTERM sends a different DA response, which includes +// the revision of the parser, not a list of features. +// TODO: Be useful... +static int +da1_syncterm_cb(inputctx* ictx){ + loginfo("read primary device attributes"); + if(ictx->initdata){ + // TODO: SyncTERM supports sixel in some modes + // but not others... discovered via CSI < Ps c + // See: https://gitlab.synchro.net/main/sbbs/-/raw/master/src/conio/cterm.txt + scrub_sixel_responses(ictx->initdata); + handoff_initial_responses_early(ictx); + } + return 1; +} + // annoyingly, alacritty (well, branches of alacritty) supports Sixel, but // does not indicate this in their Primary Device Attributes response (there // is no room for attributes in a VT102-style DA1, which alacritty uses). @@ -1378,15 +1394,6 @@ da2_cb(inputctx* ictx){ return 2; } -// weird form of Ternary Device Attributes used only by WezTerm -static int -wezterm_tda_cb(inputctx* ictx){ - if(ictx->initdata){ - loginfo("read ternary device attributes"); - } - return 2; -} - static int kittygraph_cb(inputctx* ictx){ loginfo("kitty graphics message"); @@ -1835,7 +1842,7 @@ build_cflow_automaton(inputctx* ictx){ { "[?2;0;\\N;\\NS", xtsmgraphics_sixel_cb, }, { "[>83;\\N;0c", da2_screen_cb, }, { "[>\\N;\\N;\\Nc", da2_cb, }, - { "[=\\Sc", wezterm_tda_cb, }, // CSI da3 form as issued by WezTerm + { "[=\\N;\\Dc", da1_syncterm_cb, }, // CSI da1 form as issued by SyncTERM // DCS (\eP...ST) { "P0+\\S", NULL, }, // negative XTGETTCAP { "P1+r\\S", tcap_cb, }, // positive XTGETTCAP From b6be00ed82ae6c18ba6d9dcb684b1652bdeb42a8 Mon Sep 17 00:00:00 2001 From: Stephen Hurd Date: Mon, 25 Dec 2023 06:29:10 -0500 Subject: [PATCH 2/2] Be more specific in SyncTERM DA response. SyncTERM has constant values after CSI =, so may as well avoid false matches. --- src/lib/in.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/in.c b/src/lib/in.c index bdcca2199..93e5e086e 100644 --- a/src/lib/in.c +++ b/src/lib/in.c @@ -1842,7 +1842,7 @@ build_cflow_automaton(inputctx* ictx){ { "[?2;0;\\N;\\NS", xtsmgraphics_sixel_cb, }, { "[>83;\\N;0c", da2_screen_cb, }, { "[>\\N;\\N;\\Nc", da2_cb, }, - { "[=\\N;\\Dc", da1_syncterm_cb, }, // CSI da1 form as issued by SyncTERM + { "[=67;84;101;114;109;\\Dc", da1_syncterm_cb, }, // CSI da1 form as issued by SyncTERM // DCS (\eP...ST) { "P0+\\S", NULL, }, // negative XTGETTCAP { "P1+r\\S", tcap_cb, }, // positive XTGETTCAP