]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0324: 0x9b byte not unescaped in <Cmd> mapping v9.2.0324
authorzeertzjq <zeertzjq@outlook.com>
Thu, 9 Apr 2026 18:55:02 +0000 (18:55 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 9 Apr 2026 18:55:02 +0000 (18:55 +0000)
Problem:  0x9b byte not unescaped in <Cmd> mapping (BenYip).
Solution: Translate K_CSI to CSI like what is done in vgetc().
          (zeertzjq).

fixes:  #19936
closes: #19937

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/getchar.c
src/testdir/test_mapping.vim
src/version.c

index b4ef9ce82e22d508ef829c1c405542a1d8617469..57e407b8996b01e5e5aaaebaa8f38400e7b92517 100644 (file)
@@ -4283,6 +4283,13 @@ getcmdkeycmd(
            // to a single Esc here.
            if (c1 == K_ESC)
                c1 = ESC;
+
+#ifdef FEAT_GUI
+           // Translate K_CSI to CSI.  The special key is only used to
+           // avoid it being recognized as the start of a special key.
+           if (c1 == K_CSI)
+               c1 = CSI;
+#endif
        }
 
        if (got_int)
index 01f2d1f94429565aff26d939bcd7ef9d2c92aea9..29f42848d4b704c02387c75322b5249007f54df7 100644 (file)
@@ -1124,7 +1124,11 @@ func Test_map_cmdkey()
   call setline(1, ['some short lines', 'of test text'])
   call feedkeys(":bar\<F2>x\<C-B>\"\r", 'xt')
   call assert_equal('"barx', @:)
-  unmap! <F2>
+
+  " test for chars with 0x80 or 0x9b bytes
+  map <F2> <Cmd>let x = '洛固四最倒倀'<CR>
+  call feedkeys("\<F2>", 'xt')
+  call assert_equal('洛固四最倒倀', x)
 
   " test for calling a <SID> function
   let lines =<< trim END
@@ -1137,7 +1141,10 @@ func Test_map_cmdkey()
   source Xscript
   call feedkeys("\<F2>", 'xt')
   call assert_equal(32, g:x)
+  unlet g:x
 
+  unmap <F2>
+  unmap! <F2>
   unmap <F3>
   unmap! <F3>
   %bw!
index fbe3e48eba9d41d7ccd512034f3ba1b1953e23a3..99a25eb7c1a80d821a8a2a315208ecd49fd96fe6 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    324,
 /**/
     323,
 /**/