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,
|
||||
int bufsize,
|
||||
int *buflen,
|
||||
int iskitty)
|
||||
int iskitty,
|
||||
int trail)
|
||||
{
|
||||
// Only set seenModifyOtherKeys for the "{lead}27;" code to avoid setting
|
||||
// it for terminals using the kitty keyboard protocol. Xterm sends
|
||||
@ -5376,11 +5377,11 @@ handle_key_with_modifier(
|
||||
if (key == 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]);
|
||||
|
||||
return put_key_modifiers_in_typebuf(key, modifiers,
|
||||
csi_len, offset, buf, bufsize, buflen);
|
||||
return put_key_modifiers_in_typebuf(key, modifiers, csi_len, offset, buf,
|
||||
bufsize, buflen);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -5396,7 +5397,8 @@ handle_key_without_modifier(
|
||||
int offset,
|
||||
char_u *buf,
|
||||
int bufsize,
|
||||
int *buflen)
|
||||
int *buflen,
|
||||
int trail)
|
||||
{
|
||||
char_u string[MAX_KEY_CODE_LEN + 1];
|
||||
int new_slen;
|
||||
@ -5410,7 +5412,7 @@ handle_key_without_modifier(
|
||||
string[2] = KE_ESC;
|
||||
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]);
|
||||
string[0] = K_SPECIAL;
|
||||
@ -5724,7 +5726,7 @@ handle_csi(
|
||||
{
|
||||
int iskitty = argc == 2 && (trail == 'u' || trail == '~');
|
||||
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):
|
||||
@ -5732,8 +5734,8 @@ handle_csi(
|
||||
// {lead}{key}~
|
||||
else if (argc == 1 && (trail == 'u' || trail == '~'))
|
||||
{
|
||||
return len + handle_key_without_modifier(arg,
|
||||
csi_len, offset, buf, bufsize, buflen);
|
||||
return len + handle_key_without_modifier(arg, csi_len, offset, buf,
|
||||
bufsize, buflen, trail);
|
||||
}
|
||||
|
||||
// else: Unknown CSI sequence. We could drop it, but then the
|
||||
|
||||
@ -2542,6 +2542,18 @@ func Test_mapping_kitty_function_keys2()
|
||||
set timeoutlen&
|
||||
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()
|
||||
set timeoutlen=10
|
||||
|
||||
|
||||
@ -724,6 +724,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1741,
|
||||
/**/
|
||||
1740,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user