# HG changeset patch # User Bram Moolenaar # Date 1673730903 -3600 # Node ID 59c474f6715dcd0e90d622425b7a253ace6636f9 # Parent a759a9a70b09fd8e0b6b377b4a469c5a6c93385c patch 9.0.1199: crash when using kitty and using a mapping with Commit: https://github.com/vim/vim/commit/584b853ee034754edd278d15f2966ac3d8c9d72c Author: Bram Moolenaar Date: Sat Jan 14 21:07:07 2023 +0000 patch 9.0.1199: crash when using kitty and using a mapping with Problem: Crash when using kitty and using a mapping with . Solution: Do not try setting did_simplify when it is NULL. (closes https://github.com/vim/vim/issues/11817) diff --git a/src/misc2.c b/src/misc2.c --- a/src/misc2.c +++ b/src/misc2.c @@ -1498,6 +1498,7 @@ find_special_key( key = DEL; } else if (key == 27 + && (flags & FSK_FROM_PART) != 0 && (kitty_protocol_state == KKPS_ENABLED || kitty_protocol_state == KKPS_DISABLED)) { @@ -1506,7 +1507,10 @@ find_special_key( // character and set did_simplify, then in the // non-simplified keys use K_ESC. if ((flags & FSK_SIMPLIFY) != 0) - *did_simplify = TRUE; + { + if (did_simplify != NULL) + *did_simplify = TRUE; + } else key = K_ESC; } diff --git a/src/term.c b/src/term.c --- a/src/term.c +++ b/src/term.c @@ -6636,8 +6636,10 @@ replace_termcodes( } } #endif - slen = trans_special(&src, result + dlen, FSK_KEYCODE - | ((flags & REPTERM_NO_SIMPLIFY) ? 0 : FSK_SIMPLIFY), + int fsk_flags = FSK_KEYCODE + | ((flags & REPTERM_NO_SIMPLIFY) ? 0 : FSK_SIMPLIFY) + | ((flags & REPTERM_FROM_PART) ? FSK_FROM_PART : 0); + slen = trans_special(&src, result + dlen, fsk_flags, TRUE, did_simplify); if (slen > 0) { diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1199, +/**/ 1198, /**/ 1197, diff --git a/src/vim.h b/src/vim.h --- a/src/vim.h +++ b/src/vim.h @@ -2818,6 +2818,7 @@ long elapsed(DWORD start_tick); #define FSK_KEEP_X_KEY 0x02 // don't translate xHome to Home key #define FSK_IN_STRING 0x04 // TRUE in string, double quote is escaped #define FSK_SIMPLIFY 0x08 // simplify and +#define FSK_FROM_PART 0x10 // left-hand-side of mapping // Flags for the readdirex function, how to sort the result #define READDIR_SORT_NONE 0 // do not sort