patch 9.1.1741: Regression with kitty protocol and trailing byte "u"
Problem: Regression with kitty protocol and trailing byte "u"
(chdiza, after v9.1.1736)
Solution: Check that trailing byte "~" is present
fixes: #18232
closes: #18234
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
20
src/term.c
20
src/term.c
@ -5338,7 +5338,8 @@ handle_key_with_modifier(
|
|||||||
char_u *buf,
|
char_u *buf,
|
||||||
int bufsize,
|
int bufsize,
|
||||||
int *buflen,
|
int *buflen,
|
||||||
int iskitty)
|
int iskitty,
|
||||||
|
int trail)
|
||||||
{
|
{
|
||||||
// Only set seenModifyOtherKeys for the "{lead}27;" code to avoid setting
|
// Only set seenModifyOtherKeys for the "{lead}27;" code to avoid setting
|
||||||
// it for terminals using the kitty keyboard protocol. Xterm sends
|
// it for terminals using the kitty keyboard protocol. Xterm sends
|
||||||
@ -5376,11 +5377,11 @@ handle_key_with_modifier(
|
|||||||
if (key == ESC)
|
if (key == ESC)
|
||||||
key = K_ESC;
|
key = K_ESC;
|
||||||
|
|
||||||
else if (arg[0] >= 11 && arg[0] <= 24)
|
else if (arg[0] >= 11 && arg[0] <= 24 && trail == '~')
|
||||||
key = parse_csi_f_keys(arg[0]);
|
key = parse_csi_f_keys(arg[0]);
|
||||||
|
|
||||||
return put_key_modifiers_in_typebuf(key, modifiers,
|
return put_key_modifiers_in_typebuf(key, modifiers, csi_len, offset, buf,
|
||||||
csi_len, offset, buf, bufsize, buflen);
|
bufsize, buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5396,7 +5397,8 @@ handle_key_without_modifier(
|
|||||||
int offset,
|
int offset,
|
||||||
char_u *buf,
|
char_u *buf,
|
||||||
int bufsize,
|
int bufsize,
|
||||||
int *buflen)
|
int *buflen,
|
||||||
|
int trail)
|
||||||
{
|
{
|
||||||
char_u string[MAX_KEY_CODE_LEN + 1];
|
char_u string[MAX_KEY_CODE_LEN + 1];
|
||||||
int new_slen;
|
int new_slen;
|
||||||
@ -5410,7 +5412,7 @@ handle_key_without_modifier(
|
|||||||
string[2] = KE_ESC;
|
string[2] = KE_ESC;
|
||||||
new_slen = 3;
|
new_slen = 3;
|
||||||
}
|
}
|
||||||
else if (arg[0] >= 11 && arg[0] <= 24)
|
else if (arg[0] >= 11 && arg[0] <= 24 && trail == '~')
|
||||||
{
|
{
|
||||||
int key = parse_csi_f_keys(arg[0]);
|
int key = parse_csi_f_keys(arg[0]);
|
||||||
string[0] = K_SPECIAL;
|
string[0] = K_SPECIAL;
|
||||||
@ -5724,7 +5726,7 @@ handle_csi(
|
|||||||
{
|
{
|
||||||
int iskitty = argc == 2 && (trail == 'u' || trail == '~');
|
int iskitty = argc == 2 && (trail == 'u' || trail == '~');
|
||||||
return len + handle_key_with_modifier(arg, csi_len, offset, buf,
|
return len + handle_key_with_modifier(arg, csi_len, offset, buf,
|
||||||
bufsize, buflen, iskitty);
|
bufsize, buflen, iskitty, trail);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key without modifier (Kitty sends this for Esc or F3):
|
// Key without modifier (Kitty sends this for Esc or F3):
|
||||||
@ -5732,8 +5734,8 @@ handle_csi(
|
|||||||
// {lead}{key}~
|
// {lead}{key}~
|
||||||
else if (argc == 1 && (trail == 'u' || trail == '~'))
|
else if (argc == 1 && (trail == 'u' || trail == '~'))
|
||||||
{
|
{
|
||||||
return len + handle_key_without_modifier(arg,
|
return len + handle_key_without_modifier(arg, csi_len, offset, buf,
|
||||||
csi_len, offset, buf, bufsize, buflen);
|
bufsize, buflen, trail);
|
||||||
}
|
}
|
||||||
|
|
||||||
// else: Unknown CSI sequence. We could drop it, but then the
|
// else: Unknown CSI sequence. We could drop it, but then the
|
||||||
|
|||||||
@ -2542,6 +2542,18 @@ func Test_mapping_kitty_function_keys2()
|
|||||||
set timeoutlen&
|
set timeoutlen&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_mapping_kitty_shift_enter()
|
||||||
|
new
|
||||||
|
set timeoutlen=10
|
||||||
|
|
||||||
|
imap <buffer> <S-CR> YYYY
|
||||||
|
call feedkeys(printf("i123 %s\<esc>", GetEscCodeCSIu("\<cr>", 2)),'Lx!')
|
||||||
|
call assert_equal('123 YYYY', getline(1))
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
set timeoutlen&
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_insert_literal()
|
func Test_insert_literal()
|
||||||
set timeoutlen=10
|
set timeoutlen=10
|
||||||
|
|
||||||
|
|||||||
@ -724,6 +724,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1741,
|
||||||
/**/
|
/**/
|
||||||
1740,
|
1740,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user