summaryrefslogtreecommitdiffstats
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-03-16 13:33:53 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-16 13:33:53 +0000
commit5cffa8df7e3c28681b9e5deef6df395784359b6b (patch)
tree0164635aec712ab5ca866b9f7354288664f568b1 /src/ex_getln.c
parentfe8e9f674036f3206b0080f4a931c991cf142f8b (diff)
patch 8.2.4579: cannot use page-up and page-down in the cmdline popup menuv8.2.4579
Problem: Cannot use page-up and page-down in the command line completion popup menu. Solution: Check for to page-up and page-down keys. (Yegappan Lakshmanan, closes #9960)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c47
1 files changed, 38 insertions, 9 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 4978ceec21..c84711ae03 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1757,6 +1757,7 @@ getcmdline_int(
for (;;)
{
int trigger_cmdlinechanged = TRUE;
+ int end_wildmenu;
redir_off = TRUE; // Don't redirect the typed command.
// Repeated, because a ":redir" inside
@@ -1878,10 +1879,21 @@ getcmdline_int(
}
#endif
+ // The wildmenu is cleared if the pressed key is not used for
+ // navigating the wild menu (i.e. the key is not 'wildchar' or
+ // 'wildcharm' or Ctrl-N or Ctrl-P or Ctrl-A or Ctrl-L).
+ // If the popup menu is displayed, then PageDown and PageUp keys are
+ // also used to navigate the menu.
+ end_wildmenu = (!(c == p_wc && KeyTyped) && c != p_wcm
+ && c != Ctrl_N && c != Ctrl_P && c != Ctrl_A && c != Ctrl_L);
+#ifdef FEAT_WILDMENU
+ end_wildmenu = end_wildmenu && (!cmdline_pum_active() ||
+ (c != K_PAGEDOWN && c != K_PAGEUP
+ && c != K_KPAGEDOWN && c != K_KPAGEUP));
+#endif
+
// free expanded names when finished walking through matches
- if (!(c == p_wc && KeyTyped) && c != p_wcm
- && c != Ctrl_N && c != Ctrl_P && c != Ctrl_A
- && c != Ctrl_L)
+ if (end_wildmenu)
{
#ifdef FEAT_WILDMENU
if (cmdline_pum_active())
@@ -2306,12 +2318,29 @@ getcmdline_int(
case K_KPAGEUP:
case K_PAGEDOWN:
case K_KPAGEDOWN:
- res = cmdline_browse_history(c, firstc, &lookfor, histype,
- &hiscnt, &xpc);
- if (res == CMDLINE_CHANGED)
- goto cmdline_changed;
- else if (res == GOTO_NORMAL_MODE)
- goto returncmd;
+#ifdef FEAT_WILDMENU
+ if (cmdline_pum_active()
+ && (c == K_PAGEUP || c == K_PAGEDOWN ||
+ c == K_KPAGEUP || c == K_KPAGEDOWN))
+ {
+ // If the popup menu is displayed, then PageUp and PageDown
+ // are used to scroll the menu.
+ if (nextwild(&xpc,
+ (c == K_PAGEUP) ? WILD_PAGEUP : WILD_PAGEDOWN,
+ 0, firstc != '@') == FAIL)
+ break;
+ goto cmdline_not_changed;
+ }
+ else
+#endif
+ {
+ res = cmdline_browse_history(c, firstc, &lookfor, histype,
+ &hiscnt, &xpc);
+ if (res == CMDLINE_CHANGED)
+ goto cmdline_changed;
+ else if (res == GOTO_NORMAL_MODE)
+ goto returncmd;
+ }
goto cmdline_not_changed;
#ifdef FEAT_SEARCH_EXTRA