patch 9.1.1666: no support for terminal primary device attributes

Problem:  no support for terminal primary device attributes
Solution: Add support for detecting the DA1 response from the terminal,
          add the v:termda1 variable and the 't_Ms' option for the
          OSC 52 command format (Foxe Chen)

closes: #18033

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Foxe Chen
2025-08-23 05:56:40 -04:00
committed by Christian Brabandt
parent 5d3c39af2a
commit 5734afebab
10 changed files with 52 additions and 8 deletions

View File

@ -1719,7 +1719,7 @@ static char *(key_names[]) =
"k7", "k8", "k9", "k;", "F1", "F2",
"%1", "&8", "kb", "kI", "kD", "kh",
"@7", "kP", "kN", "K1", "K3", "K4", "K5", "kB",
"PS", "PE",
"PS", "PE", "Ms",
NULL
};
#endif
@ -5495,6 +5495,8 @@ handle_csi_function_key(
* {lead}[ABCDEFHPQRS]
* {lead}1;{modifier}[ABCDEFHPQRS]
*
* - DA1 query response: {lead}?...;c
*
* Return 0 for no match, -1 for partial match, > 0 for full match.
*/
static int
@ -5607,6 +5609,22 @@ handle_csi(
*slen = csi_len;
}
// Primary device attributes (DA1) response
else if (first == '?' && trail == 'c')
{
LOG_TRN("Received DA1 response: %s", tp);
*slen = csi_len;
#ifdef FEAT_EVAL
set_vim_var_string(VV_TERMDA1, tp, *slen);
#endif
apply_autocmds(EVENT_TERMRESPONSEALL,
(char_u *)"da1", NULL, FALSE, curbuf);
key_name[0] = (int)KS_EXTRA;
key_name[1] = (int)KE_IGNORE;
}
// Version string: Eat it when there is at least one digit and
// it ends in 'c'
else if (*T_CRV != NUL && ap > argp + 1 && trail == 'c')