Skip to content

Commit b0ac4ea

Browse files
committed
patch 8.2.2221: if <Down> is mapped on the command line 'wildchar' is inserted
Problem: If <Down> is mapped on the command line 'wildchar' is inserted. Solution: Set KeyTyped when using 'wildchar'. (closes #7552)
1 parent e5730bd commit b0ac4ea

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/cmdexpand.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2680,7 +2680,10 @@ wildmenu_process_key(cmdline_info_T *cclp, int key, expand_T *xp)
26802680
// Hitting <Down> after "emenu Name.": complete submenu
26812681
if (c == K_DOWN && cclp->cmdpos > 0
26822682
&& cclp->cmdbuff[cclp->cmdpos - 1] == '.')
2683+
{
26832684
c = p_wc;
2685+
KeyTyped = TRUE; // in case the key was mapped
2686+
}
26842687
else if (c == K_UP)
26852688
{
26862689
// 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)
27142717
if (i > 0)
27152718
cmdline_del(cclp, i);
27162719
c = p_wc;
2720+
KeyTyped = TRUE; // in case the key was mapped
27172721
xp->xp_context = EXPAND_NOTHING;
27182722
}
27192723
}
@@ -2738,6 +2742,7 @@ wildmenu_process_key(cmdline_info_T *cclp, int key, expand_T *xp)
27382742
{
27392743
// go down a directory
27402744
c = p_wc;
2745+
KeyTyped = TRUE; // in case the key was mapped
27412746
}
27422747
else if (STRNCMP(xp->xp_pattern, upseg + 1, 3) == 0 && c == K_DOWN)
27432748
{
@@ -2763,6 +2768,7 @@ wildmenu_process_key(cmdline_info_T *cclp, int key, expand_T *xp)
27632768
{
27642769
cmdline_del(cclp, j - 2);
27652770
c = p_wc;
2771+
KeyTyped = TRUE; // in case the key was mapped
27662772
}
27672773
}
27682774
else if (c == K_UP)

src/testdir/test_cmdline.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ func Test_complete_wildmenu()
5858
call feedkeys(":e Xdir1/\<Tab>\<Down>\<Up>\<Right>\<CR>", 'tx')
5959
call assert_equal('testfile1', getline(1))
6060

61+
+ " <C-J>/<C-K> mappings to go up/down directories when 'wildcharm' is
62+
" different than 'wildchar'.
63+
set wildcharm=<C-Z>
64+
cnoremap <C-J> <Down><C-Z>
65+
cnoremap <C-K> <Up><C-Z>
66+
call feedkeys(":e Xdir1/\<Tab>\<C-J>\<CR>", 'tx')
67+
call assert_equal('testfile3', getline(1))
68+
call feedkeys(":e Xdir1/\<Tab>\<C-J>\<C-K>\<CR>", 'tx')
69+
call assert_equal('testfile1', getline(1))
70+
set wildcharm=0
71+
cunmap <C-J>
72+
cunmap <C-K>
73+
6174
" Test for canceling the wild menu by adding a character
6275
redrawstatus
6376
call feedkeys(":e Xdir1/\<Tab>x\<C-B>\"\<CR>", 'xt')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2221,
753755
/**/
754756
2220,
755757
/**/

0 commit comments

Comments
 (0)