diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index b4ad8af552..dbb1dbc9b8 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1188,13 +1188,11 @@ static int command_line_wildchar_complete(CommandLineState *s) bool wim_full_next = (wim_flags[1] & kOptWimFlagFull); bool wim_noselect_next = (wim_flags[1] & kOptWimFlagNoselect); if (wim_list_next || (p_wmnu && (wim_full_next || wim_noselect_next))) { - if (wim_noselect_next) { - options |= WILD_NOSELECT; - } - if (wim_full_next || wim_noselect_next) { + if (wim_full_next && !wim_noselect_next) { nextwild(&s->xpc, WILD_NEXT, options, escape); + } else { + showmatches(&s->xpc, p_wmnu, wim_list_next, wim_noselect_next); } - showmatches(&s->xpc, p_wmnu, wim_list_next, wim_noselect_next); if (wim_list_next) { s->did_wild_list = true; } diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 1af9315268..724e87d541 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -4795,9 +4795,10 @@ describe('builtin popupmenu', function() :cn^ | ]]) - feed('') command('set wildmode& wildoptions=pum') + feed('') + -- check positioning with multibyte char in pattern command('e långfile1') command('sp långfile2') @@ -4981,24 +4982,52 @@ describe('builtin popupmenu', function() -- pressing should display the wildmenu feed('') - screen:expect([[ + local s1 = [[ | {1:~ }|*4 {1:~ }{12: undefine }{1: }| {1:~ }{n: unplace }{1: }| :sign undefine^ | - ]]) + ]] + screen:expect(s1) eq(1, fn.wildmenumode()) -- pressing second time should select the next entry in the menu feed('') - screen:expect([[ + local s2 = [[ | {1:~ }|*4 {1:~ }{n: undefine }{1: }| {1:~ }{12: unplace }{1: }| :sign unplace^ | + ]] + screen:expect(s2) + eq(1, fn.wildmenumode()) + + -- If "longest" finds no candidate in "longest,full", "full" is used + feed('') + command('set wildmode=longest,full') + command('set wildoptions=pum') + feed(':sign un') + screen:expect(s1) + feed('') + screen:expect(s2) + + -- Similarly for "longest,noselect:full" + feed('') + command('set wildmode=longest,noselect:full') + feed(':sign un') + screen:expect([[ + | + {1:~ }|*4 + {1:~ }{n: undefine }{1: }| + {1:~ }{n: unplace }{1: }| + :sign un^ | ]]) + feed('') + screen:expect(s1) + feed('') + screen:expect(s2) end) it('wildoptions=pum with a wrapped line in buffer vim-patch:8.2.4655', function() diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index a52e7f8831..08df73f3f9 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -3044,6 +3044,23 @@ func Test_wildmenu_pum() call term_sendkeys(buf, ":cn\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_64', {}) + " If "longest" finds no candidate in "longest,full", "full" is used + call term_sendkeys(buf, "\:set wildmode=longest,full\") + call term_sendkeys(buf, ":set wildoptions=pum\") + call term_sendkeys(buf, ":sign un\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_09', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_10', {}) + + " Similarly for "longest,noselect:full" + call term_sendkeys(buf, "\:set wildmode=longest,noselect:full\") + call term_sendkeys(buf, ":sign un\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_65', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_09', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_10', {}) + call term_sendkeys(buf, "\\") call StopVimInTerminal(buf) endfunc