mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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)
b0ac4ea5e1
This commit is contained in:
parent
c64cce906e
commit
a51248ea17
@ -1082,6 +1082,7 @@ static int command_line_execute(VimState *state, int key)
|
|||||||
if (s->c == K_DOWN && ccline.cmdpos > 0
|
if (s->c == K_DOWN && ccline.cmdpos > 0
|
||||||
&& ccline.cmdbuff[ccline.cmdpos - 1] == '.') {
|
&& ccline.cmdbuff[ccline.cmdpos - 1] == '.') {
|
||||||
s->c = (int)p_wc;
|
s->c = (int)p_wc;
|
||||||
|
KeyTyped = true; // in case the key was mapped
|
||||||
} else if (s->c == K_UP) {
|
} else if (s->c == K_UP) {
|
||||||
// Hitting <Up>: Remove one submenu name in front of the
|
// Hitting <Up>: Remove one submenu name in front of the
|
||||||
// cursor
|
// cursor
|
||||||
@ -1112,6 +1113,7 @@ static int command_line_execute(VimState *state, int key)
|
|||||||
cmdline_del(i);
|
cmdline_del(i);
|
||||||
}
|
}
|
||||||
s->c = (int)p_wc;
|
s->c = (int)p_wc;
|
||||||
|
KeyTyped = true; // in case the key was mapped
|
||||||
s->xpc.xp_context = EXPAND_NOTHING;
|
s->xpc.xp_context = EXPAND_NOTHING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1134,6 +1136,7 @@ static int command_line_execute(VimState *state, int key)
|
|||||||
|| ccline.cmdbuff[ccline.cmdpos - 3] != '.')) {
|
|| ccline.cmdbuff[ccline.cmdpos - 3] != '.')) {
|
||||||
// go down a directory
|
// go down a directory
|
||||||
s->c = (int)p_wc;
|
s->c = (int)p_wc;
|
||||||
|
KeyTyped = true; // in case the key was mapped
|
||||||
} else if (STRNCMP(s->xpc.xp_pattern, upseg + 1, 3) == 0
|
} else if (STRNCMP(s->xpc.xp_pattern, upseg + 1, 3) == 0
|
||||||
&& s->c == K_DOWN) {
|
&& s->c == K_DOWN) {
|
||||||
// If in a direct ancestor, strip off one ../ to go 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)) {
|
&& (vim_ispathsep(ccline.cmdbuff[j - 3]) || j == i + 2)) {
|
||||||
cmdline_del(j - 2);
|
cmdline_del(j - 2);
|
||||||
s->c = (int)p_wc;
|
s->c = (int)p_wc;
|
||||||
|
KeyTyped = true; // in case the key was mapped
|
||||||
}
|
}
|
||||||
} else if (s->c == K_UP) {
|
} else if (s->c == K_UP) {
|
||||||
// go up a directory
|
// go up a directory
|
||||||
|
@ -51,6 +51,19 @@ func Test_complete_wildmenu()
|
|||||||
call feedkeys(":e Xdir1/\<Tab>\<Down>\<Up>\<Right>\<CR>", 'tx')
|
call feedkeys(":e Xdir1/\<Tab>\<Down>\<Up>\<Right>\<CR>", 'tx')
|
||||||
call assert_equal('testfile1', getline(1))
|
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
|
" cleanup
|
||||||
%bwipe
|
%bwipe
|
||||||
call delete('Xdir1/Xdir2/Xtestfile4')
|
call delete('Xdir1/Xdir2/Xtestfile4')
|
||||||
|
Loading…
Reference in New Issue
Block a user