aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-26 13:09:52 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-26 13:28:28 -0500
commita51248ea173a8602e440316f654668aaa2e27805 (patch)
treea1844501afcbcc3fc87596bb861b3dfa2d77f5a1 /src
parentc64cce906e7ed828d331e1786c985ff7aa734546 (diff)
downloadrneovim-a51248ea173a8602e440316f654668aaa2e27805.tar.gz
rneovim-a51248ea173a8602e440316f654668aaa2e27805.tar.bz2
rneovim-a51248ea173a8602e440316f654668aaa2e27805.zip
vim-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 vim/vim#7552) https://github.com/vim/vim/commit/b0ac4ea5e1c5f0ff4e951978c32ccfffe46916f8
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_getln.c4
-rw-r--r--src/nvim/testdir/test_cmdline.vim13
2 files changed, 17 insertions, 0 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 5e3cdd5da2..5868e3660f 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1082,6 +1082,7 @@ static int command_line_execute(VimState *state, int key)
if (s->c == K_DOWN && ccline.cmdpos > 0
&& ccline.cmdbuff[ccline.cmdpos - 1] == '.') {
s->c = (int)p_wc;
+ KeyTyped = true; // in case the key was mapped
} else if (s->c == K_UP) {
// Hitting <Up>: Remove one submenu name in front of the
// cursor
@@ -1112,6 +1113,7 @@ static int command_line_execute(VimState *state, int key)
cmdline_del(i);
}
s->c = (int)p_wc;
+ KeyTyped = true; // in case the key was mapped
s->xpc.xp_context = EXPAND_NOTHING;
}
}
@@ -1134,6 +1136,7 @@ static int command_line_execute(VimState *state, int key)
|| ccline.cmdbuff[ccline.cmdpos - 3] != '.')) {
// go down a directory
s->c = (int)p_wc;
+ KeyTyped = true; // in case the key was mapped
} else if (STRNCMP(s->xpc.xp_pattern, upseg + 1, 3) == 0
&& s->c == K_DOWN) {
// If in a direct ancestor, strip off one ../ to go down
@@ -1154,6 +1157,7 @@ static int command_line_execute(VimState *state, int key)
&& (vim_ispathsep(ccline.cmdbuff[j - 3]) || j == i + 2)) {
cmdline_del(j - 2);
s->c = (int)p_wc;
+ KeyTyped = true; // in case the key was mapped
}
} else if (s->c == K_UP) {
// go up a directory
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index 8fc3361b79..0c31619086 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -51,6 +51,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>
+
" cleanup
%bwipe
call delete('Xdir1/Xdir2/Xtestfile4')