]> granicus.if.org Git - vim/commitdiff
patch 9.0.1199: crash when using kitty and using a mapping with <Esc> v9.0.1199
authorBram Moolenaar <Bram@vim.org>
Sat, 14 Jan 2023 21:07:07 +0000 (21:07 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 14 Jan 2023 21:07:07 +0000 (21:07 +0000)
Problem:    Crash when using kitty and using a mapping with <Esc>.
Solution:   Do not try setting did_simplify when it is NULL. (closes #11817)

src/misc2.c
src/term.c
src/version.c
src/vim.h

index 87b1a15edd79e295242439b9f6629501c215a436..e3602ee4b80b87782dc6745621f1de1bbb89d127 100644 (file)
@@ -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;
                }
index 0b902c94ebe1c6eecc22146ebcd86be5dedf7d03..ff31b1e5d3c926d265561ee127e7d053524b59bf 100644 (file)
@@ -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)
            {
index 763c79d91c5e2da9d3803b0a5ae733ba69199583..2b472d3f99f95ecc67339da4e36a859760e9a4de 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1199,
 /**/
     1198,
 /**/
index 655935fa57d8e2be14e81e921471b6fd0321649f..7d58b06a36840a40c294b058c4efc824fff1a0d8 100644 (file)
--- 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 <C-H> and <A-x>
+#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