Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable detecting SyncTERM DA1 response. #2743

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/lib/in.c
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -1378,15 +1394,6 @@ da2_cb(inputctx* ictx){
return 2;
}

// weird form of Ternary Device Attributes used only by WezTerm
RealDeuce marked this conversation as resolved.
Show resolved Hide resolved
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");
Expand Down Expand Up @@ -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
{ "[=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
Expand Down