]> granicus.if.org Git - vim/commitdiff
patch 8.2.2221: if <Down> is mapped on the command line 'wildchar' is inserted v8.2.2221
authorBram Moolenaar <Bram@vim.org>
Sat, 26 Dec 2020 11:06:54 +0000 (12:06 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 26 Dec 2020 11:06:54 +0000 (12:06 +0100)
Problem:    If <Down> is mapped on the command line 'wildchar' is inserted.
Solution:   Set KeyTyped when using 'wildchar'. (closes #7552)

src/cmdexpand.c
src/testdir/test_cmdline.vim
src/version.c

index 4ebb6933418b68e376cda3e04889ad2057a0a67f..d51f5c6428de09f606c0140ebd54493958f6a94a 100644 (file)
@@ -2680,7 +2680,10 @@ wildmenu_process_key(cmdline_info_T *cclp, int key, expand_T *xp)
        // Hitting <Down> after "emenu Name.": complete submenu
        if (c == K_DOWN && cclp->cmdpos > 0
                && cclp->cmdbuff[cclp->cmdpos - 1] == '.')
+       {
            c = p_wc;
+           KeyTyped = TRUE;  // in case the key was mapped
+       }
        else if (c == K_UP)
        {
            // Hitting <Up>: Remove one submenu name in front of the
@@ -2714,6 +2717,7 @@ wildmenu_process_key(cmdline_info_T *cclp, int key, expand_T *xp)
            if (i > 0)
                cmdline_del(cclp, i);
            c = p_wc;
+           KeyTyped = TRUE;  // in case the key was mapped
            xp->xp_context = EXPAND_NOTHING;
        }
     }
@@ -2738,6 +2742,7 @@ wildmenu_process_key(cmdline_info_T *cclp, int key, expand_T *xp)
        {
            // go down a directory
            c = p_wc;
+           KeyTyped = TRUE;  // in case the key was mapped
        }
        else if (STRNCMP(xp->xp_pattern, upseg + 1, 3) == 0 && c == K_DOWN)
        {
@@ -2763,6 +2768,7 @@ wildmenu_process_key(cmdline_info_T *cclp, int key, expand_T *xp)
            {
                cmdline_del(cclp, j - 2);
                c = p_wc;
+               KeyTyped = TRUE;  // in case the key was mapped
            }
        }
        else if (c == K_UP)
index 1c5cac76bf1f5ae7f0e7cb7350fab666db138c1e..0127c29741bf83804b95d3897a030f989280172e 100644 (file)
@@ -58,6 +58,19 @@ func Test_complete_wildmenu()
   call feedkeys(":e Xdir1/\<Tab>\<Down>\<Up>\<Right>\<CR>", 'tx')
   call assert_equal('testfile1', getline(1))
 
+  +  " <C-J>/<C-K> mappings to go up/down directories when 'wildcharm' is
+  " different than 'wildchar'.
+  set wildcharm=<C-Z>
+  cnoremap <C-J> <Down><C-Z>
+  cnoremap <C-K> <Up><C-Z>
+  call feedkeys(":e Xdir1/\<Tab>\<C-J>\<CR>", 'tx')
+  call assert_equal('testfile3', getline(1))
+  call feedkeys(":e Xdir1/\<Tab>\<C-J>\<C-K>\<CR>", 'tx')
+  call assert_equal('testfile1', getline(1))
+  set wildcharm=0
+  cunmap <C-J>
+  cunmap <C-K>
+
   " Test for canceling the wild menu by adding a character
   redrawstatus
   call feedkeys(":e Xdir1/\<Tab>x\<C-B>\"\<CR>", 'xt')
index 63e5badbce5176f1294674a6feee3bd0a541716e..ba5df927a65150cfffa23abaa652a18ae19e2745 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2221,
 /**/
     2220,
 /**/