Skip to content

Commit

Permalink
Remove DA3 from queries emitted by term_put_level_2_queries()
Browse files Browse the repository at this point in the history
See the added comment for why.

Most terminals that reply to DA3 also reply to another query producing
the same result and/or don't respond to `TFLAG_QUERY_L3` queries anyway.
  • Loading branch information
craigbarnes committed Jan 4, 2025
1 parent fd5310b commit a6e6ae6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/terminal/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ void term_put_level_2_queries(Terminal *term, bool emit_all)
static const char queries[] =
"\033[>0q" // XTVERSION (terminal name and version)
"\033[>c" // DA2 (Secondary Device Attributes)
"\033[=c" // DA3 (Tertiary Device Attributes)
"\033[?u" // Kitty keyboard protocol flags
"\033[?1036$p" // DECRQM 1036 (metaSendsEscape; must be after kitty query)
"\033[?1039$p" // DECRQM 1039 (altSendsEscape; must be after kitty query)
Expand Down
5 changes: 5 additions & 0 deletions src/terminal/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ KeyCode parse_dcs_query_reply(const char *data, size_t len, bool truncated)
// https://vt100.net/docs/vt510-rm/DA3.html
// https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#:~:text=(-,Tertiary%20DA,-)
if (strview_remove_matching_prefix(&seq, "!|")) {
// Note that DA3 is no longer sent by term_put_level_2_queries(),
// because several terminals (including Termux) have buggy handling
// of CSI sequences containing '=', which causes "c" to be rendered
// (but not inserted into the buffer) at startup.
// See also: https://github.com/fish-shell/fish-shell/commit/e49dde87cc0f1dcedd424d5ed7a520a3f011ee29
LOG_INFO("DA3 reply: %.*s", (int)seq.length, seq.data);
return tflag(TFLAG_QUERY_L3);
}
Expand Down
1 change: 0 additions & 1 deletion test/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,6 @@ static void test_term_put_level_1_queries(TestContext *ctx)
// term_put_level_2_queries()
"\033[>0q"
"\033[>c"
"\033[=c"
"\033[?u"
"\033[?1036$p"
"\033[?1039$p"
Expand Down

0 comments on commit a6e6ae6

Please sign in to comment.