Mercurial > vim
comparison src/ex_getln.c @ 28109:06535d568f74 v8.2.4579
patch 8.2.4579: cannot use page-up and page-down in the cmdline popup menu
Commit: https://github.com/vim/vim/commit/5cffa8df7e3c28681b9e5deef6df395784359b6b
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Wed Mar 16 13:33:53 2022 +0000
patch 8.2.4579: cannot use page-up and page-down in the cmdline popup menu
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 16 Mar 2022 14:45:04 +0100 |
parents | 7a60eaa9cb26 |
children | 4765d97b4d8b |
comparison
equal
deleted
inserted
replaced
28108:00e653cb7b22 | 28109:06535d568f74 |
---|---|
1755 * Collect the command string, handling editing keys. | 1755 * Collect the command string, handling editing keys. |
1756 */ | 1756 */ |
1757 for (;;) | 1757 for (;;) |
1758 { | 1758 { |
1759 int trigger_cmdlinechanged = TRUE; | 1759 int trigger_cmdlinechanged = TRUE; |
1760 int end_wildmenu; | |
1760 | 1761 |
1761 redir_off = TRUE; // Don't redirect the typed command. | 1762 redir_off = TRUE; // Don't redirect the typed command. |
1762 // Repeated, because a ":redir" inside | 1763 // Repeated, because a ":redir" inside |
1763 // completion may switch it on. | 1764 // completion may switch it on. |
1764 #ifdef USE_ON_FLY_SCROLL | 1765 #ifdef USE_ON_FLY_SCROLL |
1876 c = Ctrl_E; | 1877 c = Ctrl_E; |
1877 } | 1878 } |
1878 } | 1879 } |
1879 #endif | 1880 #endif |
1880 | 1881 |
1882 // The wildmenu is cleared if the pressed key is not used for | |
1883 // navigating the wild menu (i.e. the key is not 'wildchar' or | |
1884 // 'wildcharm' or Ctrl-N or Ctrl-P or Ctrl-A or Ctrl-L). | |
1885 // If the popup menu is displayed, then PageDown and PageUp keys are | |
1886 // also used to navigate the menu. | |
1887 end_wildmenu = (!(c == p_wc && KeyTyped) && c != p_wcm | |
1888 && c != Ctrl_N && c != Ctrl_P && c != Ctrl_A && c != Ctrl_L); | |
1889 #ifdef FEAT_WILDMENU | |
1890 end_wildmenu = end_wildmenu && (!cmdline_pum_active() || | |
1891 (c != K_PAGEDOWN && c != K_PAGEUP | |
1892 && c != K_KPAGEDOWN && c != K_KPAGEUP)); | |
1893 #endif | |
1894 | |
1881 // free expanded names when finished walking through matches | 1895 // free expanded names when finished walking through matches |
1882 if (!(c == p_wc && KeyTyped) && c != p_wcm | 1896 if (end_wildmenu) |
1883 && c != Ctrl_N && c != Ctrl_P && c != Ctrl_A | |
1884 && c != Ctrl_L) | |
1885 { | 1897 { |
1886 #ifdef FEAT_WILDMENU | 1898 #ifdef FEAT_WILDMENU |
1887 if (cmdline_pum_active()) | 1899 if (cmdline_pum_active()) |
1888 cmdline_pum_remove(); | 1900 cmdline_pum_remove(); |
1889 #endif | 1901 #endif |
2304 case K_S_DOWN: | 2316 case K_S_DOWN: |
2305 case K_PAGEUP: | 2317 case K_PAGEUP: |
2306 case K_KPAGEUP: | 2318 case K_KPAGEUP: |
2307 case K_PAGEDOWN: | 2319 case K_PAGEDOWN: |
2308 case K_KPAGEDOWN: | 2320 case K_KPAGEDOWN: |
2309 res = cmdline_browse_history(c, firstc, &lookfor, histype, | 2321 #ifdef FEAT_WILDMENU |
2310 &hiscnt, &xpc); | 2322 if (cmdline_pum_active() |
2311 if (res == CMDLINE_CHANGED) | 2323 && (c == K_PAGEUP || c == K_PAGEDOWN || |
2312 goto cmdline_changed; | 2324 c == K_KPAGEUP || c == K_KPAGEDOWN)) |
2313 else if (res == GOTO_NORMAL_MODE) | 2325 { |
2314 goto returncmd; | 2326 // If the popup menu is displayed, then PageUp and PageDown |
2327 // are used to scroll the menu. | |
2328 if (nextwild(&xpc, | |
2329 (c == K_PAGEUP) ? WILD_PAGEUP : WILD_PAGEDOWN, | |
2330 0, firstc != '@') == FAIL) | |
2331 break; | |
2332 goto cmdline_not_changed; | |
2333 } | |
2334 else | |
2335 #endif | |
2336 { | |
2337 res = cmdline_browse_history(c, firstc, &lookfor, histype, | |
2338 &hiscnt, &xpc); | |
2339 if (res == CMDLINE_CHANGED) | |
2340 goto cmdline_changed; | |
2341 else if (res == GOTO_NORMAL_MODE) | |
2342 goto returncmd; | |
2343 } | |
2315 goto cmdline_not_changed; | 2344 goto cmdline_not_changed; |
2316 | 2345 |
2317 #ifdef FEAT_SEARCH_EXTRA | 2346 #ifdef FEAT_SEARCH_EXTRA |
2318 case Ctrl_G: // next match | 2347 case Ctrl_G: // next match |
2319 case Ctrl_T: // previous match | 2348 case Ctrl_T: // previous match |