diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-02-08 12:08:07 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-08 12:08:07 +0000 |
commit | 3908ef5017a6b4425727013588f72cc7343199b9 (patch) | |
tree | e70cbd04c972b1566a45e8536210e1334e1b0373 /src/ex_getln.c | |
parent | 3787f26c2ed33732a36f26ebe46faeebfe0151af (diff) | |
download | vim-git-3908ef5017a6b4425727013588f72cc7343199b9.tar.gz |
patch 8.2.4325: 'wildmenu' only shows few matchesv8.2.4325
Problem: 'wildmenu' only shows few matches.
Solution: Add the "pum" option: use a popup menu to show the matches.
(Yegappan Lakshmanan et al., closes #9707)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 097b97eeb..5def8a6a2 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -924,9 +924,18 @@ cmdline_wildchar_complete( // if 'wildmode' contains "list" may still need to list if (xp->xp_numfiles > 1 && !*did_wild_list - && (wim_flags[wim_index] & WIM_LIST)) + && ((wim_flags[wim_index] & WIM_LIST) +#ifdef FEAT_WILDMENU + || (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0) +#endif + )) { +#ifdef FEAT_WILDMENU + (void)showmatches(xp, + p_wmnu && ((wim_flags[wim_index] & WIM_LIST) == 0)); +#else (void)showmatches(xp, FALSE); +#endif redrawcmd(); *did_wild_list = TRUE; } @@ -1848,6 +1857,23 @@ getcmdline_int( #ifdef FEAT_WILDMENU c = wildmenu_translate_key(&ccline, c, &xpc, did_wild_list); + + if (cmdline_pum_active()) + { + if (c == Ctrl_E || c == Ctrl_Y) + { + int wild_type; + + wild_type = (c == Ctrl_E) ? WILD_CANCEL : WILD_APPLY; + + if (nextwild(&xpc, wild_type, WILD_NO_BEEP, + firstc != '@') == FAIL) + break; + cmdline_pum_cleanup(&ccline); + xpc.xp_context = EXPAND_NOTHING; + goto cmdline_changed; + } + } #endif // free expanded names when finished walking through matches @@ -1856,6 +1882,9 @@ getcmdline_int( && c != Ctrl_N && c != Ctrl_P && c != Ctrl_A && c != Ctrl_L) { +#ifdef FEAT_WILDMENU + cmdline_pum_remove(); +#endif (void)ExpandOne(&xpc, NULL, NULL, 0, WILD_FREE); did_wild_list = FALSE; #ifdef FEAT_WILDMENU @@ -1950,10 +1979,19 @@ getcmdline_int( // <S-Tab> goes to last match, in a clumsy way if (c == K_S_TAB && KeyTyped) { - if (nextwild(&xpc, WILD_EXPAND_KEEP, 0, firstc != '@') == OK - && nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK - && nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK) - goto cmdline_changed; + if (nextwild(&xpc, WILD_EXPAND_KEEP, 0, firstc != '@') == OK) + { +#ifdef FEAT_WILDMENU + // Trigger the popup menu when wildoptions=pum + showmatches(&xpc, + p_wmnu && ((wim_flags[wim_index] & WIM_LIST) == 0)); +#else + (void)showmatches(&xpc, FALSE); +#endif + if (nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK + && nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK) + goto cmdline_changed; + } } if (c == NUL || c == K_ZERO) // NUL is stored as NL @@ -2222,6 +2260,13 @@ getcmdline_int( case Ctrl_A: // all matches if (nextwild(&xpc, WILD_ALL, 0, firstc != '@') == FAIL) break; +#ifdef FEAT_WILDMENU + if (cmdline_pum_active()) + { + cmdline_pum_cleanup(&ccline); + xpc.xp_context = EXPAND_NOTHING; + } +#endif goto cmdline_changed; case Ctrl_L: |