mirror of
https://github.com/vim/vim.git
synced 2025-10-21 08:24:06 -04:00
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:
committed by
Christian Brabandt
parent
5d3c39af2a
commit
5734afebab
@@ -164,7 +164,8 @@ static struct vimvar
|
||||
{VV_NAME("stacktrace", VAR_LIST), &t_list_dict_any, VV_RO},
|
||||
{VV_NAME("t_tuple", VAR_NUMBER), NULL, VV_RO},
|
||||
{VV_NAME("wayland_display", VAR_STRING), NULL, VV_RO},
|
||||
{VV_NAME("clipmethod", VAR_STRING), NULL, VV_RO},
|
||||
{VV_NAME("clipmethod", VAR_STRING), NULL, VV_RO},
|
||||
{VV_NAME("termda1", VAR_STRING), NULL, VV_RO},
|
||||
};
|
||||
|
||||
// shorthand
|
||||
|
20
src/term.c
20
src/term.c
@@ -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')
|
||||
|
@@ -2803,4 +2803,9 @@ func Test_xterm_direct_no_termguicolors()
|
||||
close
|
||||
endfunc
|
||||
|
||||
func Test_da1_handling()
|
||||
call feedkeys("\<Esc>[?62,52;c", 'Lx!')
|
||||
call assert_equal("\<Esc>[?62,52;c", v:termda1)
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
@@ -724,6 +724,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1666,
|
||||
/**/
|
||||
1665,
|
||||
/**/
|
||||
|
@@ -2239,7 +2239,8 @@ typedef int sock_T;
|
||||
#define VV_TYPE_TUPLE 111
|
||||
#define VV_WAYLAND_DISPLAY 112
|
||||
#define VV_CLIPMETHOD 113
|
||||
#define VV_LEN 114 // number of v: vars
|
||||
#define VV_TERMDA1 114
|
||||
#define VV_LEN 115 // number of v: vars
|
||||
|
||||
// used for v_number in VAR_BOOL and VAR_SPECIAL
|
||||
#define VVAL_FALSE 0L // VAR_BOOL
|
||||
|
Reference in New Issue
Block a user