diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-02-10 19:52:10 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-10 19:52:10 +0000 |
commit | 560dff49c0095111fc96b4b8dd7f4d269aba9473 (patch) | |
tree | cd986c6411c522080f4e4d360bcfcfc99841162c /src/ex_getln.c | |
parent | 74a0a5b26d0180f3ea89e9495dff6a26f0df23cb (diff) | |
download | vim-git-560dff49c0095111fc96b4b8dd7f4d269aba9473.tar.gz |
patch 8.2.4339: CTRL-A does not work properly with the cmdline popup menuv8.2.4339
Problem: CTRL-A does not work properly with the cmdline popup menu.
Solution: Fix issues with CTRL-A. Add more tests for the cmdline popup
menu. Remove TermWait() before VeriryScreenDump(). Refactor the
cmdline popup code. (Yegappan Lakshmanan, closes #9735)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 63f1c5dcb..f9b5b604f 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1860,6 +1860,9 @@ getcmdline_int( if (cmdline_pum_active()) { + // Ctrl-Y: Accept the current selection and close the popup menu. + // Ctrl-E: cancel the cmdline popup menu and return the original + // text. if (c == Ctrl_E || c == Ctrl_Y) { int wild_type; @@ -1869,16 +1872,13 @@ getcmdline_int( if (nextwild(&xpc, wild_type, WILD_NO_BEEP, firstc != '@') == FAIL) break; - cmdline_pum_cleanup(&ccline); - xpc.xp_context = EXPAND_NOTHING; - goto cmdline_changed; + c = Ctrl_E; } } #endif // free expanded names when finished walking through matches - if (xpc.xp_numfiles != -1 - && !(c == p_wc && KeyTyped) && c != p_wcm + if (!(c == p_wc && KeyTyped) && c != p_wcm && c != Ctrl_N && c != Ctrl_P && c != Ctrl_A && c != Ctrl_L) { @@ -1886,7 +1886,8 @@ getcmdline_int( if (cmdline_pum_active()) cmdline_pum_remove(); #endif - (void)ExpandOne(&xpc, NULL, NULL, 0, WILD_FREE); + if (xpc.xp_numfiles != -1) + (void)ExpandOne(&xpc, NULL, NULL, 0, WILD_FREE); did_wild_list = FALSE; #ifdef FEAT_WILDMENU if (!p_wmnu || (c != K_UP && c != K_DOWN)) @@ -1982,13 +1983,16 @@ getcmdline_int( { if (nextwild(&xpc, WILD_EXPAND_KEEP, 0, firstc != '@') == OK) { + if (xpc.xp_numfiles > 1) + { #ifdef FEAT_WILDMENU - // Trigger the popup menu when wildoptions=pum - showmatches(&xpc, - p_wmnu && ((wim_flags[wim_index] & WIM_LIST) == 0)); + // Trigger the popup menu when wildoptions=pum + showmatches(&xpc, p_wmnu + && ((wim_flags[wim_index] & WIM_LIST) == 0)); #else - (void)showmatches(&xpc, FALSE); + (void)showmatches(&xpc, FALSE); #endif + } if (nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK && nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK) goto cmdline_changed; @@ -2259,15 +2263,16 @@ getcmdline_int( goto cmdline_not_changed; case Ctrl_A: // all matches - if (nextwild(&xpc, WILD_ALL, 0, firstc != '@') == FAIL) - break; #ifdef FEAT_WILDMENU if (cmdline_pum_active()) - { + // As Ctrl-A completes all the matches, close the popup + // menu (if present) cmdline_pum_cleanup(&ccline); - xpc.xp_context = EXPAND_NOTHING; - } #endif + if (nextwild(&xpc, WILD_ALL, 0, firstc != '@') == FAIL) + break; + xpc.xp_context = EXPAND_NOTHING; + did_wild_list = FALSE; goto cmdline_changed; case Ctrl_L: |