comparison src/ex_getln.c @ 28121:4765d97b4d8b v8.2.4585

patch 8.2.4585: cannot use keypad page-up/down for completion menu Commit: https://github.com/vim/vim/commit/155b0882088ff115dcfb6ce466fe7c8cc2bef349 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Thu Mar 17 13:03:09 2022 +0000 patch 8.2.4585: cannot use keypad page-up/down for completion menu Problem: Cannot use keypad page-up/down for completion menu. Solution: Recognize the keypad keys. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/9963)
author Bram Moolenaar <Bram@vim.org>
date Thu, 17 Mar 2022 14:15:04 +0100
parents 06535d568f74
children d1702731786c
comparison
equal deleted inserted replaced
28120:001b1aa6fc14 28121:4765d97b4d8b
1604 expand_T xpc; 1604 expand_T xpc;
1605 long *b_im_ptr = NULL; 1605 long *b_im_ptr = NULL;
1606 cmdline_info_T save_ccline; 1606 cmdline_info_T save_ccline;
1607 int did_save_ccline = FALSE; 1607 int did_save_ccline = FALSE;
1608 int cmdline_type; 1608 int cmdline_type;
1609 int wild_type;
1609 1610
1610 if (ccline.cmdbuff != NULL) 1611 if (ccline.cmdbuff != NULL)
1611 { 1612 {
1612 // Being called recursively. Since ccline is global, we need to save 1613 // Being called recursively. Since ccline is global, we need to save
1613 // the current buffer and restore it when returning. 1614 // the current buffer and restore it when returning.
1865 // Ctrl-Y: Accept the current selection and close the popup menu. 1866 // Ctrl-Y: Accept the current selection and close the popup menu.
1866 // Ctrl-E: cancel the cmdline popup menu and return the original 1867 // Ctrl-E: cancel the cmdline popup menu and return the original
1867 // text. 1868 // text.
1868 if (c == Ctrl_E || c == Ctrl_Y) 1869 if (c == Ctrl_E || c == Ctrl_Y)
1869 { 1870 {
1870 int wild_type;
1871
1872 wild_type = (c == Ctrl_E) ? WILD_CANCEL : WILD_APPLY; 1871 wild_type = (c == Ctrl_E) ? WILD_CANCEL : WILD_APPLY;
1873
1874 if (nextwild(&xpc, wild_type, WILD_NO_BEEP, 1872 if (nextwild(&xpc, wild_type, WILD_NO_BEEP,
1875 firstc != '@') == FAIL) 1873 firstc != '@') == FAIL)
1876 break; 1874 break;
1877 c = Ctrl_E; 1875 c = Ctrl_E;
1878 } 1876 }
2302 2300
2303 case Ctrl_N: // next match 2301 case Ctrl_N: // next match
2304 case Ctrl_P: // previous match 2302 case Ctrl_P: // previous match
2305 if (xpc.xp_numfiles > 0) 2303 if (xpc.xp_numfiles > 0)
2306 { 2304 {
2307 if (nextwild(&xpc, (c == Ctrl_P) ? WILD_PREV : WILD_NEXT, 2305 wild_type = (c == Ctrl_P) ? WILD_PREV : WILD_NEXT;
2308 0, firstc != '@') == FAIL) 2306 if (nextwild(&xpc, wild_type, 0, firstc != '@') == FAIL)
2309 break; 2307 break;
2310 goto cmdline_not_changed; 2308 goto cmdline_not_changed;
2311 } 2309 }
2312 // FALLTHROUGH 2310 // FALLTHROUGH
2313 case K_UP: 2311 case K_UP:
2323 && (c == K_PAGEUP || c == K_PAGEDOWN || 2321 && (c == K_PAGEUP || c == K_PAGEDOWN ||
2324 c == K_KPAGEUP || c == K_KPAGEDOWN)) 2322 c == K_KPAGEUP || c == K_KPAGEDOWN))
2325 { 2323 {
2326 // If the popup menu is displayed, then PageUp and PageDown 2324 // If the popup menu is displayed, then PageUp and PageDown
2327 // are used to scroll the menu. 2325 // are used to scroll the menu.
2328 if (nextwild(&xpc, 2326 wild_type = WILD_PAGEUP;
2329 (c == K_PAGEUP) ? WILD_PAGEUP : WILD_PAGEDOWN, 2327 if (c == K_PAGEDOWN || c == K_KPAGEDOWN)
2330 0, firstc != '@') == FAIL) 2328 wild_type = WILD_PAGEDOWN;
2329 if (nextwild(&xpc, wild_type, 0, firstc != '@') == FAIL)
2331 break; 2330 break;
2332 goto cmdline_not_changed; 2331 goto cmdline_not_changed;
2333 } 2332 }
2334 else 2333 else
2335 #endif 2334 #endif