To: vim_dev@googlegroups.com Subject: Patch 8.2.4339 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.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) Files: src/cmdexpand.c, src/ex_getln.c, src/popupmenu.c, src/testdir/screendump.vim, src/testdir/test_bufline.vim, src/testdir/test_cmdline.vim, src/testdir/test_conceal.vim, src/testdir/test_cursorline.vim, src/testdir/test_diffmode.vim, src/testdir/test_display.vim, src/testdir/test_highlight.vim, src/testdir/test_match.vim, src/testdir/test_popup.vim, src/testdir/test_search_stat.vim, src/testdir/test_terminal.vim, src/testdir/test_textprop.vim, src/testdir/dumps/Test_wildmenu_pum_33.dump, src/testdir/dumps/Test_wildmenu_pum_34.dump, src/testdir/dumps/Test_wildmenu_pum_35.dump, src/testdir/dumps/Test_wildmenu_pum_36.dump, src/testdir/dumps/Test_wildmenu_pum_37.dump *** ../vim-8.2.4338/src/cmdexpand.c 2022-02-09 11:55:28.004059225 +0000 --- src/cmdexpand.c 2022-02-10 19:45:42.722021143 +0000 *************** *** 37,42 **** --- 37,44 ---- static int compl_selected; #endif + #define SHOW_FILE_TEXT(m) (showtail ? sm_gettail(files_found[m]) : files_found[m]) + static int sort_func_compare(const void *s1, const void *s2) { *************** *** 256,261 **** --- 258,311 ---- } #if defined(FEAT_WILDMENU) || defined(PROTO) + + /* + * Create and display a cmdline completion popup menu with items from + * 'files_found'. + */ + static int + cmdline_pum_create( + cmdline_info_T *ccline, + expand_T *xp, + char_u **files_found, + int num_files, + int showtail) + { + int i; + int columns; + + // Add all the completion matches + compl_match_arraysize = num_files; + compl_match_array = ALLOC_MULT(pumitem_T, compl_match_arraysize); + for (i = 0; i < num_files; i++) + { + compl_match_array[i].pum_text = SHOW_FILE_TEXT(i); + compl_match_array[i].pum_info = NULL; + compl_match_array[i].pum_extra = NULL; + compl_match_array[i].pum_kind = NULL; + } + + // Compute the popup menu starting column + compl_startcol = vim_strsize(ccline->cmdbuff) + 1; + columns = vim_strsize(xp->xp_pattern); + if (showtail) + { + columns += vim_strsize(sm_gettail(files_found[0])); + columns -= vim_strsize(files_found[0]); + } + if (columns >= compl_startcol) + compl_startcol = 0; + else + compl_startcol -= columns; + + // no default selection + compl_selected = -1; + + cmdline_pum_display(); + + return EXPAND_OK; + } + /* * Display the cmdline completion matches in a popup menu */ *************** *** 264,276 **** pum_display(compl_match_array, compl_match_arraysize, compl_selected); } int cmdline_pum_active(void) { return p_wmnu && pum_visible() && compl_match_array != NULL; } /* ! * Remove the cmdline completion popup menu */ void cmdline_pum_remove(void) { --- 314,330 ---- pum_display(compl_match_array, compl_match_arraysize, compl_selected); } + /* + * Returns TRUE if the cmdline completion popup menu is being displayed. + */ int cmdline_pum_active(void) { return p_wmnu && pum_visible() && compl_match_array != NULL; } /* ! * Remove the cmdline completion popup menu (if present), free the list of ! * items and refresh the screen. */ void cmdline_pum_remove(void) { *************** *** 285,290 **** --- 339,348 ---- wildmenu_cleanup(cclp); } + /* + * Returns the starting column number to use for the cmdline completion popup + * menu. + */ int cmdline_compl_startcol(void) { return compl_startcol; *************** *** 581,587 **** showmatches(expand_T *xp, int wildmenu UNUSED) { cmdline_info_T *ccline = get_cmdline_info(); - #define L_SHOWFILE(m) (showtail ? sm_gettail(files_found[m]) : files_found[m]) int num_files; char_u **files_found; int i, j, k; --- 639,644 ---- *************** *** 612,642 **** #ifdef FEAT_WILDMENU if (wildmenu && vim_strchr(p_wop, WOP_PUM) != NULL) ! { ! compl_match_arraysize = num_files; ! compl_match_array = ALLOC_MULT(pumitem_T, compl_match_arraysize); ! for (i = 0; i < num_files; i++) ! { ! compl_match_array[i].pum_text = L_SHOWFILE(i); ! compl_match_array[i].pum_info = NULL; ! compl_match_array[i].pum_extra = NULL; ! compl_match_array[i].pum_kind = NULL; ! } ! compl_startcol = vim_strsize(ccline->cmdbuff) + 1; ! columns = vim_strsize(xp->xp_pattern); ! if (showtail) ! { ! columns += vim_strsize(sm_gettail(files_found[0])); ! columns -= vim_strsize(files_found[0]); ! } ! if (columns >= compl_startcol) ! compl_startcol = 0; ! else ! compl_startcol -= columns; ! compl_selected = -1; ! cmdline_pum_display(); ! return EXPAND_OK; ! } #endif #ifdef FEAT_WILDMENU --- 669,676 ---- #ifdef FEAT_WILDMENU if (wildmenu && vim_strchr(p_wop, WOP_PUM) != NULL) ! // cmdline completion popup menu (with wildoptions=pum) ! return cmdline_pum_create(ccline, xp, files_found, num_files, showtail); #endif #ifdef FEAT_WILDMENU *************** *** 674,680 **** j = vim_strsize(NameBuff); } else ! j = vim_strsize(L_SHOWFILE(i)); if (j > maxlen) maxlen = j; } --- 708,714 ---- j = vim_strsize(NameBuff); } else ! j = vim_strsize(SHOW_FILE_TEXT(i)); if (j > maxlen) maxlen = j; } *************** *** 746,752 **** // Expansion was done here, file names are literal. j = mch_isdir(files_found[k]); if (showtail) ! p = L_SHOWFILE(k); else { home_replace(NULL, files_found[k], NameBuff, MAXPATHL, --- 780,786 ---- // Expansion was done here, file names are literal. j = mch_isdir(files_found[k]); if (showtail) ! p = SHOW_FILE_TEXT(k); else { home_replace(NULL, files_found[k], NameBuff, MAXPATHL, *************** *** 757,763 **** else { j = FALSE; ! p = L_SHOWFILE(k); } lastlen = msg_outtrans_attr(p, j ? attr : 0); } --- 791,797 ---- else { j = FALSE; ! p = SHOW_FILE_TEXT(k); } lastlen = msg_outtrans_attr(p, j ? attr : 0); } *************** *** 2726,2743 **** int c = key; #ifdef FEAT_WILDMENU ! if (p_wmnu && cmdline_pum_active()) { ! // When the popup menu is used, Up/Down keys go to the previous and ! // next items in the menu and Left/Right keys go up/down a directory. ! if (c == K_UP) ! c = K_LEFT; ! else if (c == K_DOWN) ! c = K_RIGHT; ! else if (c == K_LEFT) ! c = K_UP; ! else if (c == K_RIGHT) ! c = K_DOWN; } #endif --- 2760,2780 ---- int c = key; #ifdef FEAT_WILDMENU ! if (cmdline_pum_active()) { ! // When the popup menu is used for cmdline completion: ! // Up : go to the previous item in the menu ! // Down : go to the next item in the menu ! // Left : go to the parent directory ! // Right: list the files in the selected directory ! switch (c) ! { ! case K_UP: c = K_LEFT; break; ! case K_DOWN: c = K_RIGHT; break; ! case K_LEFT: c = K_UP; break; ! case K_RIGHT: c = K_DOWN; break; ! default: break; ! } } #endif *** ../vim-8.2.4338/src/ex_getln.c 2022-02-08 17:40:13.649047302 +0000 --- src/ex_getln.c 2022-02-10 19:08:54.804967219 +0000 *************** *** 1860,1865 **** --- 1860,1868 ---- 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,1884 **** 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 ! if (xpc.xp_numfiles != -1 ! && !(c == p_wc && KeyTyped) && c != p_wcm && c != Ctrl_N && c != Ctrl_P && c != Ctrl_A && c != Ctrl_L) { --- 1872,1884 ---- if (nextwild(&xpc, wild_type, WILD_NO_BEEP, firstc != '@') == FAIL) break; ! c = Ctrl_E; } } #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) { *************** *** 1886,1892 **** if (cmdline_pum_active()) cmdline_pum_remove(); #endif ! (void)ExpandOne(&xpc, NULL, NULL, 0, WILD_FREE); did_wild_list = FALSE; #ifdef FEAT_WILDMENU if (!p_wmnu || (c != K_UP && c != K_DOWN)) --- 1886,1893 ---- if (cmdline_pum_active()) cmdline_pum_remove(); #endif ! 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,1994 **** { 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; --- 1983,1998 ---- { 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)); #else ! (void)showmatches(&xpc, FALSE); #endif + } if (nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK && nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK) goto cmdline_changed; *************** *** 2259,2273 **** 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()) ! { cmdline_pum_cleanup(&ccline); - xpc.xp_context = EXPAND_NOTHING; - } #endif goto cmdline_changed; case Ctrl_L: --- 2263,2278 ---- goto cmdline_not_changed; case Ctrl_A: // all matches #ifdef FEAT_WILDMENU if (cmdline_pum_active()) ! // As Ctrl-A completes all the matches, close the popup ! // menu (if present) cmdline_pum_cleanup(&ccline); #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: *** ../vim-8.2.4338/src/popupmenu.c 2022-02-08 12:07:41.835496899 +0000 --- src/popupmenu.c 2022-02-10 19:08:54.804967219 +0000 *************** *** 117,122 **** --- 117,123 ---- // can decide when to reposition the popup menu. pum_window = curwin; if (State == CMDLINE) + // cmdline completion popup menu pum_win_row = cmdline_row; else pum_win_row = curwin->w_wrow + W_WINROW(curwin); *************** *** 220,225 **** --- 221,227 ---- // Calculate column #ifdef FEAT_WILDMENU if (State == CMDLINE) + // cmdline completion popup menu cursor_col = cmdline_compl_startcol(); else #endif *** ../vim-8.2.4338/src/testdir/screendump.vim 2020-03-18 20:10:41.104567492 +0000 --- src/testdir/screendump.vim 2022-02-10 19:08:54.804967219 +0000 *************** *** 27,32 **** --- 27,35 ---- " Starting a terminal to make a screendump is always considered flaky. let g:test_is_flaky = 1 + " wait for the pending updates to be handled. + call TermWait(a:buf) + " Redraw to execute the code that updates the screen. Otherwise we get the " text and attributes only from the internal buffer. redraw *** ../vim-8.2.4338/src/testdir/test_bufline.vim 2021-02-09 19:02:52.618109261 +0000 --- src/testdir/test_bufline.vim 2022-02-10 19:08:54.804967219 +0000 *************** *** 216,222 **** END call writefile(lines, 'XscriptMatchCommon') let buf = RunVimInTerminal('-S XscriptMatchCommon', #{rows: 10}) - call TermWait(buf) call VerifyScreenDump(buf, 'Test_appendbufline_1', {}) call StopVimInTerminal(buf) --- 216,221 ---- *** ../vim-8.2.4338/src/testdir/test_cmdline.vim 2022-02-09 11:55:28.004059225 +0000 --- src/testdir/test_cmdline.vim 2022-02-10 19:08:54.808967212 +0000 *************** *** 91,97 **** cnoremap wildmenumode() call feedkeys(":cd Xdir\\\\"\", 'tx') ! call assert_equal('"cd Xdir1/1', @:) cunmap " cleanup --- 91,99 ---- cnoremap wildmenumode() call feedkeys(":cd Xdir\\\\"\", 'tx') ! call assert_equal('"cd Xdir1/0', @:) ! call feedkeys(":e Xdir1/\\\\"\", 'tx') ! call assert_equal('"e Xdir1/Xdir2/1', @:) cunmap " cleanup *************** *** 1976,2014 **** set shm+=I set noruler set noshowcmd [CODE] call writefile(commands, 'Xtest') let buf = RunVimInTerminal('-S Xtest', #{rows: 10}) call term_sendkeys(buf, ":sign \") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_01', {}) call term_sendkeys(buf, "\\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_02', {}) call term_sendkeys(buf, "\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_03', {}) call term_sendkeys(buf, "\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_04', {}) call term_sendkeys(buf, "\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_05', {}) " pressing should end completion and go back to the original match call term_sendkeys(buf, "\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_06', {}) " pressing should select the current match and end completion call term_sendkeys(buf, "\\\\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_07', {}) " With 'wildmode' set to 'longest,full', completing a match should display --- 1978,2018 ---- set shm+=I set noruler set noshowcmd + + func CmdCompl(a, b, c) + return repeat(['aaaa'], 120) + endfunc + command -nargs=* -complete=customlist,CmdCompl Tcmd [CODE] call writefile(commands, 'Xtest') let buf = RunVimInTerminal('-S Xtest', #{rows: 10}) call term_sendkeys(buf, ":sign \") call VerifyScreenDump(buf, 'Test_wildmenu_pum_01', {}) + " going down the popup menu using call term_sendkeys(buf, "\\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_02', {}) + " going down the popup menu using call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_03', {}) + " going up the popup menu using call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_04', {}) + " going up the popup menu using call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_05', {}) " pressing should end completion and go back to the original match call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_06', {}) " pressing should select the current match and end completion call term_sendkeys(buf, "\\\\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_07', {}) " With 'wildmode' set to 'longest,full', completing a match should display *************** *** 2016,2046 **** call term_sendkeys(buf, ":\set wildmode=longest,full\") call TermWait(buf) call term_sendkeys(buf, ":sign u\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_08', {}) " pressing should display the wildmenu call term_sendkeys(buf, "\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_09', {}) " pressing second time should select the next entry in the menu call term_sendkeys(buf, "\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_10', {}) call term_sendkeys(buf, ":\set wildmode=full\") ! " " showing popup menu in different columns in the cmdline call term_sendkeys(buf, ":sign define \") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_11', {}) call term_sendkeys(buf, " \") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_12', {}) call term_sendkeys(buf, " \") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_13', {}) " Directory name completion --- 2020,2044 ---- call term_sendkeys(buf, ":\set wildmode=longest,full\") call TermWait(buf) call term_sendkeys(buf, ":sign u\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_08', {}) " pressing should display the wildmenu call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_09', {}) " pressing second time should select the next entry in the menu call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_10', {}) call term_sendkeys(buf, ":\set wildmode=full\") ! " showing popup menu in different columns in the cmdline call term_sendkeys(buf, ":sign define \") call VerifyScreenDump(buf, 'Test_wildmenu_pum_11', {}) call term_sendkeys(buf, " \") call VerifyScreenDump(buf, 'Test_wildmenu_pum_12', {}) call term_sendkeys(buf, " \") call VerifyScreenDump(buf, 'Test_wildmenu_pum_13', {}) " Directory name completion *************** *** 2050,2144 **** call writefile([], 'Xdir/XdirA/XdirB/XfileC') call term_sendkeys(buf, "\e Xdi\\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_14', {}) " Pressing on a directory name should go into that directory call term_sendkeys(buf, "\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_15', {}) " Pressing on a directory name should go to the parent directory call term_sendkeys(buf, "\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_16', {}) " Pressing when the popup menu is displayed should list all the ! " matches and remove the popup menu call term_sendkeys(buf, "\sign \\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_17', {}) " Pressing when the popup menu is displayed should remove the popup " menu call term_sendkeys(buf, "\sign \\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_18', {}) " Pressing should open the popup menu with the last entry selected call term_sendkeys(buf, "\\:sign \\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_19', {}) " Pressing should close the popup menu and cancel the cmd line call term_sendkeys(buf, "\\:sign \\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_20', {}) " Typing a character when the popup is open, should close the popup call term_sendkeys(buf, ":sign \x") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_21', {}) " When the popup is open, entering the cmdline window should close the popup call term_sendkeys(buf, "\sign \\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_22', {}) call term_sendkeys(buf, ":q\") " After the last popup menu item, should show the original string call term_sendkeys(buf, ":sign u\\\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_23', {}) " Use the popup menu for the command name call term_sendkeys(buf, "\bu\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_24', {}) " Pressing the left arrow should remove the popup menu call term_sendkeys(buf, "\\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_25', {}) " Pressing should remove the popup menu and erase the last character call term_sendkeys(buf, "\\sign \\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_26', {}) " Pressing should remove the popup menu and erase the previous word call term_sendkeys(buf, "\\sign \\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_27', {}) " Pressing should remove the popup menu and erase the entire line call term_sendkeys(buf, "\\sign \\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_28', {}) " Using to cancel the popup menu and then pressing should recall " the cmdline from history call term_sendkeys(buf, "sign xyz\:sign \\\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_29', {}) " Check "list" still works call term_sendkeys(buf, "\set wildmode=longest,list\") call term_sendkeys(buf, ":cn\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_30', {}) call term_sendkeys(buf, "s") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {}) " Tests a directory name contained full-width characters. --- 2048,2124 ---- call writefile([], 'Xdir/XdirA/XdirB/XfileC') call term_sendkeys(buf, "\e Xdi\\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_14', {}) " Pressing on a directory name should go into that directory call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_15', {}) " Pressing on a directory name should go to the parent directory call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_16', {}) " Pressing when the popup menu is displayed should list all the ! " matches but the popup menu should still remain call term_sendkeys(buf, "\sign \\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_17', {}) " Pressing when the popup menu is displayed should remove the popup " menu call term_sendkeys(buf, "\sign \\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_18', {}) " Pressing should open the popup menu with the last entry selected call term_sendkeys(buf, "\\:sign \\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_19', {}) " Pressing should close the popup menu and cancel the cmd line call term_sendkeys(buf, "\\:sign \\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_20', {}) " Typing a character when the popup is open, should close the popup call term_sendkeys(buf, ":sign \x") call VerifyScreenDump(buf, 'Test_wildmenu_pum_21', {}) " When the popup is open, entering the cmdline window should close the popup call term_sendkeys(buf, "\sign \\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_22', {}) call term_sendkeys(buf, ":q\") " After the last popup menu item, should show the original string call term_sendkeys(buf, ":sign u\\\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_23', {}) " Use the popup menu for the command name call term_sendkeys(buf, "\bu\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_24', {}) " Pressing the left arrow should remove the popup menu call term_sendkeys(buf, "\\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_25', {}) " Pressing should remove the popup menu and erase the last character call term_sendkeys(buf, "\\sign \\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_26', {}) " Pressing should remove the popup menu and erase the previous word call term_sendkeys(buf, "\\sign \\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_27', {}) " Pressing should remove the popup menu and erase the entire line call term_sendkeys(buf, "\\sign \\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_28', {}) " Using to cancel the popup menu and then pressing should recall " the cmdline from history call term_sendkeys(buf, "sign xyz\:sign \\\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_29', {}) " Check "list" still works call term_sendkeys(buf, "\set wildmode=longest,list\") call term_sendkeys(buf, ":cn\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_30', {}) call term_sendkeys(buf, "s") call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {}) " Tests a directory name contained full-width characters. *************** *** 2149,2161 **** call term_sendkeys(buf, "\set wildmode&\") call term_sendkeys(buf, ":\e Xdir/あいう/\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_wildmenu_pum_32', {}) call term_sendkeys(buf, "\\") call StopVimInTerminal(buf) call delete('Xtest') call delete('Xdir', 'rf') endfunc " vim: shiftwidth=2 sts=2 expandtab --- 2129,2186 ---- call term_sendkeys(buf, "\set wildmode&\") call term_sendkeys(buf, ":\e Xdir/あいう/\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_32', {}) + " Pressing when the popup menu is displayed should list all the + " matches and pressing a key after that should remove the popup menu + call term_sendkeys(buf, "\set wildmode=full\") + call term_sendkeys(buf, ":sign \\x") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_33', {}) + + " Pressing when the popup menu is displayed should list all the + " matches and pressing after that should move the cursor + call term_sendkeys(buf, "\abc\") + call term_sendkeys(buf, ":sign \\\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_34', {}) + + " When displays a lot of matches (screen scrolls), all the matches + " should be displayed correctly on the screen. + call term_sendkeys(buf, "\\Tcmd \\\\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_35', {}) + + " After using to expand all the filename matches, pressing + " should not open the popup menu again. + call term_sendkeys(buf, "\\:cd Xdir/XdirA\") + call term_sendkeys(buf, ":e \\\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_36', {}) + call term_sendkeys(buf, "\\:cd -\") + + " After using to expand all the matches, pressing used to + " crash Vim + call term_sendkeys(buf, ":sign \\\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_37', {}) + call term_sendkeys(buf, "\\") call StopVimInTerminal(buf) call delete('Xtest') call delete('Xdir', 'rf') endfunc + " Test for wildmenumode() with the cmdline popup menu + func Test_wildmenumode_with_pum() + set wildmenu + set wildoptions=pum + cnoremap wildmenumode() + call feedkeys(":sign \\\\\"\", 'xt') + call assert_equal('"sign define10', @:) + call feedkeys(":sign \\\\\"\", 'xt') + call assert_equal('"sign define jump list place undefine unplace0', @:) + call feedkeys(":sign \\\\\"\", 'xt') + call assert_equal('"sign 0', @:) + call feedkeys(":sign \\\\\"\", 'xt') + call assert_equal('"sign define0', @:) + set nowildmenu wildoptions& + cunmap + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.4338/src/testdir/test_conceal.vim 2022-01-23 12:42:51.833379130 +0000 --- src/testdir/test_conceal.vim 2022-02-10 19:08:54.808967212 +0000 *************** *** 154,160 **** call VerifyScreenDump(buf, 'Test_conceal_resize_01', {}) call win_execute(buf->win_findbuf()[0], 'wincmd +') - call TermWait(buf) call VerifyScreenDump(buf, 'Test_conceal_resize_02', {}) " clean up --- 154,159 ---- *** ../vim-8.2.4338/src/testdir/test_cursorline.vim 2021-08-05 16:56:03.208718221 +0100 --- src/testdir/test_cursorline.vim 2022-02-10 19:08:54.808967212 +0000 *************** *** 136,176 **** call writefile(lines, filename) " basic test let buf = RunVimInTerminal('-S '. filename, #{rows: 20}) - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_1', {}) call term_sendkeys(buf, "fagj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_2', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_3', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_4', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_5', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_6', {}) " test with set list and cursorlineopt containing number call term_sendkeys(buf, "gg0") call term_sendkeys(buf, ":set list cursorlineopt+=number listchars=space:-\") call VerifyScreenDump(buf, 'Test_'. filename. '_7', {}) call term_sendkeys(buf, "fagj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_8', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_9', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_10', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_11', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_12', {}) if exists("+foldcolumn") && exists("+signcolumn") && exists("+breakindent") " test with set foldcolumn signcoloumn and breakindent --- 136,165 ---- *************** *** 178,196 **** call term_sendkeys(buf, ":set breakindent foldcolumn=2 signcolumn=yes\") call VerifyScreenDump(buf, 'Test_'. filename. '_13', {}) call term_sendkeys(buf, "fagj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_14', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_15', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_16', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_17', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_18', {}) call term_sendkeys(buf, ":set breakindent& foldcolumn& signcolumn&\") endif --- 167,180 ---- *************** *** 200,218 **** call term_sendkeys(buf, ":set nonumber\") call VerifyScreenDump(buf, 'Test_'. filename. '_19', {}) call term_sendkeys(buf, "fagj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_20', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_21', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_22', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_23', {}) call term_sendkeys(buf, "gj") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_'. filename. '_24', {}) call term_sendkeys(buf, ":set list& cursorlineopt& listchars&\") --- 184,197 ---- *** ../vim-8.2.4338/src/testdir/test_diffmode.vim 2022-01-27 13:16:54.332078790 +0000 --- src/testdir/test_diffmode.vim 2022-02-10 19:08:54.808967212 +0000 *************** *** 851,857 **** call term_sendkeys(a:buf, ":diffupdate!\") " trailing : for leaving the cursor on the command line call term_sendkeys(a:buf, ":set diffopt=internal,filler" . a:extra . "\:") - call TermWait(a:buf) call VerifyScreenDump(a:buf, a:dumpfile, {}) endfunc --- 851,856 ---- *** ../vim-8.2.4338/src/testdir/test_display.vim 2021-12-18 15:32:38.064496744 +0000 --- src/testdir/test_display.vim 2022-02-10 19:08:54.808967212 +0000 *************** *** 175,181 **** call writefile(lines, filename) let buf = RunVimInTerminal('-S '.filename, #{rows: 5, cols: 50}) call term_sendkeys(buf, "k") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_winline_rnu', {}) " clean up --- 175,180 ---- *** ../vim-8.2.4338/src/testdir/test_highlight.vim 2022-01-29 21:45:30.485921485 +0000 --- src/testdir/test_highlight.vim 2022-02-10 19:08:54.808967212 +0000 *************** *** 662,668 **** call writefile(lines, 'Xtest_colorcolumn') let buf = RunVimInTerminal('-S Xtest_colorcolumn', {'rows': 10}) call term_sendkeys(buf, ":\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_colorcolumn_1', {}) " clean up --- 662,667 ---- *************** *** 680,686 **** call writefile(lines, 'Xtest_colorcolumn_bri') let buf = RunVimInTerminal('-S Xtest_colorcolumn_bri', {'rows': 10,'columns': 40}) call term_sendkeys(buf, ":set co=40 linebreak bri briopt=shift:2 cc=40,41,43\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_colorcolumn_2', {}) " clean up --- 679,684 ---- *************** *** 698,704 **** call writefile(lines, 'Xtest_colorcolumn_srb') let buf = RunVimInTerminal('-S Xtest_colorcolumn_srb', {'rows': 10,'columns': 40}) call term_sendkeys(buf, ":set co=40 showbreak=+++>\\ cc=40,41,43\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_colorcolumn_3', {}) " clean up --- 696,701 ---- *** ../vim-8.2.4338/src/testdir/test_match.vim 2022-01-11 13:14:32.978510736 +0000 --- src/testdir/test_match.vim 2022-02-10 19:08:54.808967212 +0000 *************** *** 359,365 **** END call writefile(lines, 'XscriptMatchLinebreak') let buf = RunVimInTerminal('-S XscriptMatchLinebreak', #{rows: 10}) - call TermWait(buf) call VerifyScreenDump(buf, 'Test_match_linebreak', {}) call StopVimInTerminal(buf) --- 359,364 ---- *************** *** 376,382 **** END call writefile(lines, 'XmatchWithIncsearch') let buf = RunVimInTerminal('-S XmatchWithIncsearch', #{rows: 6}) - call TermWait(buf) call VerifyScreenDump(buf, 'Test_match_with_incsearch_1', {}) call term_sendkeys(buf, ":s/0") --- 375,380 ---- *************** *** 417,423 **** END call writefile(lines, 'XscriptMatchTabLinebreak') let buf = RunVimInTerminal('-S XscriptMatchTabLinebreak', #{rows: 10}) - call TermWait(buf) call VerifyScreenDump(buf, 'Test_match_tab_linebreak', {}) call StopVimInTerminal(buf) --- 415,420 ---- *** ../vim-8.2.4338/src/testdir/test_popup.vim 2021-10-16 13:00:10.940165406 +0100 --- src/testdir/test_popup.vim 2022-02-10 19:08:54.808967212 +0000 *************** *** 1164,1170 **** let buf = RunVimInTerminal('--cmd "set rightleft" Xtest1', {}) call term_wait(buf) call term_sendkeys(buf, "Go\") - call term_wait(buf) call VerifyScreenDump(buf, 'Test_pum_rightleft_01', {'rows': 8}) call term_sendkeys(buf, "\\") call term_wait(buf) --- 1164,1169 ---- *************** *** 1206,1212 **** let buf = RunVimInTerminal('--cmd "set pumheight=2" Xtest1', {}) call term_wait(buf) call term_sendkeys(buf, "Go\\\") - call term_wait(buf) call VerifyScreenDump(buf, 'Test_pum_scrollbar_01', {'rows': 7}) call term_sendkeys(buf, "\\dd") call term_wait(buf) --- 1205,1210 ---- *************** *** 1215,1221 **** call term_sendkeys(buf, ":set rightleft\") call term_wait(buf) call term_sendkeys(buf, "Go\\\") - call term_wait(buf) call VerifyScreenDump(buf, 'Test_pum_scrollbar_02', {'rows': 7}) endif --- 1213,1218 ---- *** ../vim-8.2.4338/src/testdir/test_search_stat.vim 2021-11-12 10:29:42.178810539 +0000 --- src/testdir/test_search_stat.vim 2022-02-10 19:08:54.808967212 +0000 *************** *** 312,326 **** call writefile(lines, 'Xsearchstat1') let buf = RunVimInTerminal('-S Xsearchstat1', #{rows: 10}) - call TermWait(buf) call VerifyScreenDump(buf, 'Test_searchstat_3', {}) call term_sendkeys(buf, "n") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_searchstat_3', {}) call term_sendkeys(buf, "n") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_searchstat_3', {}) call StopVimInTerminal(buf) --- 312,323 ---- *************** *** 343,354 **** END call writefile(lines, 'Xsearchstat') let buf = RunVimInTerminal('-S Xsearchstat', #{rows: 10}) - call TermWait(buf) call VerifyScreenDump(buf, 'Test_searchstat_1', {}) call term_sendkeys(buf, ":nnoremap n n\") call term_sendkeys(buf, "gg0n") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_searchstat_2', {}) call StopVimInTerminal(buf) --- 340,349 ---- *************** *** 367,377 **** let buf = RunVimInTerminal('-S Xsearchstatgd', #{rows: 10}) call term_sendkeys(buf, "/dog\") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_searchstatgd_1', {}) call term_sendkeys(buf, "G0gD") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_searchstatgd_2', {}) call StopVimInTerminal(buf) --- 362,370 ---- *** ../vim-8.2.4338/src/testdir/test_terminal.vim 2022-01-20 14:57:18.284528166 +0000 --- src/testdir/test_terminal.vim 2022-02-10 19:08:54.808967212 +0000 *************** *** 1137,1154 **** " Send a focus event to ourselves, it should be forwarded to the terminal call feedkeys("\[O", "Lx!") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_terminal_focus_1', {}) call feedkeys("\[I", "Lx!") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_terminal_focus_2', {}) " check that a command line being edited is redrawn in place call term_sendkeys(buf, ":" .. repeat('x', 80)) call TermWait(buf) call feedkeys("\[O", "Lx!") - call TermWait(buf) call VerifyScreenDump(buf, 'Test_terminal_focus_3', {}) call term_sendkeys(buf, "\") --- 1137,1151 ---- *** ../vim-8.2.4338/src/testdir/test_textprop.vim 2022-01-29 21:45:30.485921485 +0000 --- src/testdir/test_textprop.vim 2022-02-10 19:08:54.808967212 +0000 *************** *** 1626,1632 **** END call writefile(lines, 'XscriptPropLinebreak') let buf = RunVimInTerminal('-S XscriptPropLinebreak', #{rows: 10}) - call TermWait(buf) call VerifyScreenDump(buf, 'Test_prop_linebreak', {}) call StopVimInTerminal(buf) --- 1626,1631 ---- *************** *** 1644,1650 **** END call writefile(lines, 'XscriptPropAfterTab') let buf = RunVimInTerminal('-S XscriptPropAfterTab', #{rows: 10}) - call TermWait(buf) call VerifyScreenDump(buf, 'Test_prop_after_tab', {}) call StopVimInTerminal(buf) --- 1643,1648 ---- *************** *** 1662,1668 **** END call writefile(lines, 'XscriptPropAfterLinebreak') let buf = RunVimInTerminal('-S XscriptPropAfterLinebreak', #{rows: 10}) - call TermWait(buf) call VerifyScreenDump(buf, 'Test_prop_after_linebreak', {}) call StopVimInTerminal(buf) --- 1660,1665 ---- *** ../vim-8.2.4338/src/testdir/dumps/Test_wildmenu_pum_33.dump 2022-02-10 19:50:15.709678352 +0000 --- src/testdir/dumps/Test_wildmenu_pum_33.dump 2022-02-10 19:08:54.804967219 +0000 *************** *** 0 **** --- 1,10 ---- + | +0&#ffffff0@74 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |:+0#0000000&|s|i|g|n| |d|e|f|i|n|e| |j|u|m|p| |l|i|s|t| |p|l|a|c|e| |u|n|d|e|f|i|n|e| |u|n|p|l|a|c|e|x> @28 *** ../vim-8.2.4338/src/testdir/dumps/Test_wildmenu_pum_34.dump 2022-02-10 19:50:15.713678346 +0000 --- src/testdir/dumps/Test_wildmenu_pum_34.dump 2022-02-10 19:08:54.804967219 +0000 *************** *** 0 **** --- 1,10 ---- + | +0&#ffffff0@74 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |:+0#0000000&|s|i|g|n| |d|e|f|i|n|e| |j|u|m|p| |l|i|s|t| |p|l|a|c|e| |u|n|d|e|f|i|n|e| |u|n|p|l|a|c>e| @29 *** ../vim-8.2.4338/src/testdir/dumps/Test_wildmenu_pum_35.dump 2022-02-10 19:50:15.717678341 +0000 --- src/testdir/dumps/Test_wildmenu_pum_35.dump 2022-02-10 19:08:54.804967219 +0000 *************** *** 0 **** --- 1,10 ---- + |~+0#4040ff13#ffffff0| @73 + |:+0#0000000&|T|c|m|d| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3 + | |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3 + | |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3 + | |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3 + | |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3 + | |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3 + | |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3 + | |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3| |a@3 + | |a@1>a@1| @69 *** ../vim-8.2.4338/src/testdir/dumps/Test_wildmenu_pum_36.dump 2022-02-10 19:50:15.721678336 +0000 --- src/testdir/dumps/Test_wildmenu_pum_36.dump 2022-02-10 19:08:54.804967219 +0000 *************** *** 0 **** --- 1,10 ---- + | +0&#ffffff0@74 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |:+0#0000000&|e| |X|d|i|r|B|/| |X|f|i|l|e|B> @58 *** ../vim-8.2.4338/src/testdir/dumps/Test_wildmenu_pum_37.dump 2022-02-10 19:50:15.725678331 +0000 --- src/testdir/dumps/Test_wildmenu_pum_37.dump 2022-02-10 19:08:54.804967219 +0000 *************** *** 0 **** --- 1,10 ---- + | +0&#ffffff0@74 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |:+0#0000000&|s|i|g|n| |d|e|f|i|n|e| |j|u|m|p| |l|i|s|t| |p|l|a|c|e| |u|n|d|e|f|i|n|e| |u|n|p|l|a|c|e> @29 *** ../vim-8.2.4338/src/version.c 2022-02-10 14:03:56.030129442 +0000 --- src/version.c 2022-02-10 19:11:47.912786785 +0000 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4339, /**/ -- How To Keep A Healthy Level Of Insanity: 14. Put mosquito netting around your work area. Play a tape of jungle sounds all day. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///