Skip to content

Commit 584b853

Browse files
committed
patch 9.0.1199: crash when using kitty and using a mapping with <Esc>
Problem: Crash when using kitty and using a mapping with <Esc>. Solution: Do not try setting did_simplify when it is NULL. (closes #11817)
1 parent 24a8d06 commit 584b853

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/misc2.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,7 @@ find_special_key(
14981498
key = DEL;
14991499
}
15001500
else if (key == 27
1501+
&& (flags & FSK_FROM_PART) != 0
15011502
&& (kitty_protocol_state == KKPS_ENABLED
15021503
|| kitty_protocol_state == KKPS_DISABLED))
15031504
{
@@ -1506,7 +1507,10 @@ find_special_key(
15061507
// character and set did_simplify, then in the
15071508
// non-simplified keys use K_ESC.
15081509
if ((flags & FSK_SIMPLIFY) != 0)
1509-
*did_simplify = TRUE;
1510+
{
1511+
if (did_simplify != NULL)
1512+
*did_simplify = TRUE;
1513+
}
15101514
else
15111515
key = K_ESC;
15121516
}

src/term.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6636,8 +6636,10 @@ replace_termcodes(
66366636
}
66376637
}
66386638
#endif
6639-
slen = trans_special(&src, result + dlen, FSK_KEYCODE
6640-
| ((flags & REPTERM_NO_SIMPLIFY) ? 0 : FSK_SIMPLIFY),
6639+
int fsk_flags = FSK_KEYCODE
6640+
| ((flags & REPTERM_NO_SIMPLIFY) ? 0 : FSK_SIMPLIFY)
6641+
| ((flags & REPTERM_FROM_PART) ? FSK_FROM_PART : 0);
6642+
slen = trans_special(&src, result + dlen, fsk_flags,
66416643
TRUE, did_simplify);
66426644
if (slen > 0)
66436645
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ static char *(features[]) =
695695

696696
static int included_patches[] =
697697
{ /* Add new patch number below this line */
698+
/**/
699+
1199,
698700
/**/
699701
1198,
700702
/**/

src/vim.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,6 +2818,7 @@ long elapsed(DWORD start_tick);
28182818
#define FSK_KEEP_X_KEY 0x02 // don't translate xHome to Home key
28192819
#define FSK_IN_STRING 0x04 // TRUE in string, double quote is escaped
28202820
#define FSK_SIMPLIFY 0x08 // simplify <C-H> and <A-x>
2821+
#define FSK_FROM_PART 0x10 // left-hand-side of mapping
28212822

28222823
// Flags for the readdirex function, how to sort the result
28232824
#define READDIR_SORT_NONE 0 // do not sort

0 commit comments

Comments
 (0)