From a51248ea173a8602e440316f654668aaa2e27805 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 26 Dec 2020 13:09:52 -0500 Subject: vim-patch:8.2.2221: if is mapped on the command line 'wildchar' is inserted Problem: If 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 --- src/nvim/ex_getln.c | 4 ++++ src/nvim/testdir/test_cmdline.vim | 13 +++++++++++++ 2 files changed, 17 insertions(+) (limited to 'src') 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 : 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/\\\\\", 'tx') call assert_equal('testfile1', getline(1)) + + " / mappings to go up/down directories when 'wildcharm' is + " different than 'wildchar'. + set wildcharm= + cnoremap + cnoremap + call feedkeys(":e Xdir1/\\\", 'tx') + call assert_equal('testfile3', getline(1)) + call feedkeys(":e Xdir1/\\\\", 'tx') + call assert_equal('testfile1', getline(1)) + set wildcharm=0 + cunmap + cunmap + " cleanup %bwipe call delete('Xdir1/Xdir2/Xtestfile4') -- cgit