// Remove popup window if no completion items are available
if (redraw_if_menu_empty && xp->xp_numfiles <= 0)
+ {
update_screen(0);
+ redrawcmd(); // Ensure initial pasted text appears on cmdline
+ }
// if interrupted while completing, behave like it failed
if (got_int)
// Display matches
if (res == OK && xp->xp_numfiles > (wim_noselect ? 0 : 1))
{
- // If "longest" fails to identify the longest item, try other
- // 'wim' values if available
- if (wim_longest && ccline.cmdpos == cmdpos_before)
+ if (wim_longest)
{
- if (wim_full)
- nextwild(xp, WILD_NEXT, options, escape);
+ int found_longest_prefix = (ccline.cmdpos != cmdpos_before);
if (wim_list || (p_wmnu && wim_full))
- (void)showmatches(xp, p_wmnu, wim_list, FALSE);
+ (void)showmatches(xp, p_wmnu, wim_list, TRUE);
+ else if (!found_longest_prefix)
+ {
+ int wim_list_next = (wim_flags[1] & WIM_LIST);
+ int wim_full_next = (wim_flags[1] & WIM_FULL);
+ int wim_noselect_next = (wim_flags[1] & WIM_NOSELECT);
+ 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)
+ nextwild(xp, WILD_NEXT, options, escape);
+ (void)showmatches(xp, p_wmnu, wim_list_next,
+ wim_noselect_next);
+ }
+ }
}
- else if (!wim_longest)
+ else
{
if (wim_list || (p_wmnu && (wim_full || wim_noselect)))
(void)showmatches(xp, p_wmnu, wim_list, wim_noselect);
call term_sendkeys(buf, "\<C-U>set wildmode=longest,list\<CR>")
call term_sendkeys(buf, ":cn\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_pum_30', {})
- call term_sendkeys(buf, "\<Tab>")
+ call term_sendkeys(buf, "s")
call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {})
" Tests a directory name contained full-width characters.
call term_sendkeys(buf, "\<Esc>:set showtabline& laststatus& lazyredraw&\<CR>")
- " Verify that if "longest" finds nothing, wildmenu is still shown
- call term_sendkeys(buf, ":set wildmode=longest:full,full wildoptions&\<CR>")
- call term_sendkeys(buf, ":cn\<Tab>")
- call TermWait(buf, 50)
- call VerifyScreenDump(buf, 'Test_wildmenu_pum_54', {})
-
- " Verify that if "longest" finds nothing, "list" is still shown
- call term_sendkeys(buf, "\<Esc>:set wildmode=longest:list,full\<CR>")
+ " "longest:list" shows list whether it finds a candidate or not
+ call term_sendkeys(buf, ":set wildmode=longest:list,full wildoptions&\<CR>")
call term_sendkeys(buf, ":cn\<Tab>")
call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_wildmenu_pum_55', {})
call term_sendkeys(buf, "\<Tab>")
call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_wildmenu_pum_56', {})
+ call term_sendkeys(buf, "\<Esc>:sign u\<Tab>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_57', {})
- " Verify that if "longest" finds a candidate, wildmenu is not shown
- call term_sendkeys(buf, "\<Esc>:set wildmode=longest:full,full wildoptions&\<CR>")
+ " "longest:full" shows wildmenu whether it finds a candidate or not; item not selected
+ call term_sendkeys(buf, "\<Esc>:set wildmode=longest:full,full\<CR>")
call term_sendkeys(buf, ":sign u\<Tab>")
- call VerifyScreenDump(buf, 'Test_wildmenu_pum_57', {})
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_58', {})
+ call term_sendkeys(buf, "\<Tab>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_59', {})
+ call term_sendkeys(buf, "\<Esc>:cn\<Tab>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_60', {})
+ call term_sendkeys(buf, "\<Tab>")
+ call TermWait(buf, 50)
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_61', {})
+
+ " If "longest,full" finds a candidate, wildmenu is not shown
+ call term_sendkeys(buf, "\<Esc>:set wildmode=longest,full\<CR>")
+ call term_sendkeys(buf, ":sign u\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_62', {})
" Subsequent wildchar shows wildmenu
call term_sendkeys(buf, "\<Tab>")
- call VerifyScreenDump(buf, 'Test_wildmenu_pum_58', {})
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_63', {})
+
+ " 'longest' does not find candidate, and displays menu without selecting item
+ call term_sendkeys(buf, "\<Esc>:set wildmode=longest,noselect\<CR>")
+ call term_sendkeys(buf, ":cn\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_pum_64', {})
call term_sendkeys(buf, "\<C-U>\<Esc>")
call StopVimInTerminal(buf)