]> granicus.if.org Git - vim/commitdiff
patch 8.2.4502: in the GUI a modifier is not recognized after CTRL-X v8.2.4502
authorBram Moolenaar <Bram@vim.org>
Fri, 4 Mar 2022 14:51:06 +0000 (14:51 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 4 Mar 2022 14:51:06 +0000 (14:51 +0000)
Problem:    In the GUI a modifier is not recognized for the key typed after
            CTRL-X, which may result in a mapping to be used. (Daniel
            Steinberg)
Solution:   Recognize a modifier starting with CSI. (closes #9889)

src/getchar.c
src/testdir/test_ins_complete.vim
src/version.c

index 9939bbdbcb971b5c09db0bedc1d595e5d00190a7..2fbbd4f6e1255826ff0f26018f16c72bad5a4eda 100644 (file)
@@ -2331,7 +2331,7 @@ at_ctrl_x_key(void)
     int            c = *p;
 
     if (typebuf.tb_len > 3
-           && c == K_SPECIAL
+           && (c == K_SPECIAL || c == CSI)  // CSI is used by the GUI
            && p[1] == KS_MODIFIER
            && (p[2] & MOD_MASK_CTRL))
        c = p[3] & 0x1f;
index 033bb37f1217b5b2c6418c453a6b23ceb3d58a80..3712abe69085e9c8bd189a9caf69782e5a12b926 100644 (file)
@@ -1294,7 +1294,18 @@ func Test_z1_complete_no_history()
   exe "normal owh\<C-X>\<C-K>"
   exe "normal owh\<C-N>"
   call assert_equal(currmess, execute('messages'))
-  close!
+  bwipe!
+endfunc
+
+" A mapping is not used for the key after CTRL-X.
+func Test_no_mapping_for_ctrl_x_key()
+  new
+  inoremap <C-K> <Cmd>let was_mapped = 'yes'<CR>
+  setlocal dictionary=README.txt
+  call feedkeys("aexam\<C-X>\<C-K> ", 'xt')
+  call assert_equal('example ', getline(1))
+  call assert_false(exists('was_mapped'))
+  bwipe!
 endfunc
 
 " Test for different ways of setting the 'completefunc' option
index 18a0442ee8f6172a866f38e884fbaac9c66d5f47..51dc6de624add458e64119b6bb0fb656344e52be 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4502,
 /**/
     4501,
 /**/