To: vim_dev@googlegroups.com Subject: Patch 8.2.1580 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1580 Problem: Wildmenu does not work properly. Solution: Do not call may_do_incsearch_highlighting() if completion is in progress. Files: src/ex_getln.c, src/testdir/test_cmdline.vim, src/testdir/dumps/Test_wildmenu_1.dump, src/testdir/dumps/Test_wildmenu_2.dump, src/testdir/dumps/Test_wildmenu_3.dump, src/testdir/dumps/Test_wildmenu_4.dump *** ../vim-8.2.1579/src/ex_getln.c 2020-08-20 15:02:38.536534973 +0200 --- src/ex_getln.c 2020-09-03 16:47:38.830056574 +0200 *************** *** 397,403 **** // NOTE: must call restore_last_search_pattern() before returning! save_last_search_pattern(); ! if (!do_incsearch_highlighting(firstc, &search_delim, is_state, &skiplen, &patlen)) { restore_last_search_pattern(); finish_incsearch_highlighting(FALSE, is_state, TRUE); --- 397,404 ---- // NOTE: must call restore_last_search_pattern() before returning! save_last_search_pattern(); ! if (!do_incsearch_highlighting(firstc, &search_delim, is_state, ! &skiplen, &patlen)) { restore_last_search_pattern(); finish_incsearch_highlighting(FALSE, is_state, TRUE); *************** *** 1235,1244 **** if (has_mbyte) j -= (*mb_head_off)(ccline.cmdbuff, ccline.cmdbuff + j); if (vim_ispathsep(ccline.cmdbuff[j]) ! #ifdef BACKSLASH_IN_FILENAME && vim_strchr((char_u *)" *?[{`$%#", ccline.cmdbuff[j + 1]) == NULL ! #endif ) { if (found) --- 1236,1245 ---- if (has_mbyte) j -= (*mb_head_off)(ccline.cmdbuff, ccline.cmdbuff + j); if (vim_ispathsep(ccline.cmdbuff[j]) ! # ifdef BACKSLASH_IN_FILENAME && vim_strchr((char_u *)" *?[{`$%#", ccline.cmdbuff[j + 1]) == NULL ! # endif ) { if (found) *************** *** 1425,1430 **** --- 1426,1432 ---- if ((c == p_wc && !gotesc && KeyTyped) || c == p_wcm) { int options = WILD_NO_BEEP; + if (wim_flags[wim_index] & WIM_BUFLASTUSED) options |= WILD_BUFLASTUSED; if (xpc.xp_numfiles > 0) // typed p_wc at least twice *************** *** 1442,1449 **** res = nextwild(&xpc, WILD_LONGEST, options, firstc != '@'); else if (wim_flags[wim_index] & WIM_FULL) ! res = nextwild(&xpc, WILD_NEXT, options, ! firstc != '@'); else res = OK; // don't insert 'wildchar' now } --- 1444,1450 ---- res = nextwild(&xpc, WILD_LONGEST, options, firstc != '@'); else if (wim_flags[wim_index] & WIM_FULL) ! res = nextwild(&xpc, WILD_NEXT, options, firstc != '@'); else res = OK; // don't insert 'wildchar' now } *************** *** 1454,1464 **** // if 'wildmode' first contains "longest", get longest // common part if (wim_flags[0] & WIM_LONGEST) ! res = nextwild(&xpc, WILD_LONGEST, options, ! firstc != '@'); else res = nextwild(&xpc, WILD_EXPAND_KEEP, options, ! firstc != '@'); // if interrupted while completing, behave like it failed if (got_int) --- 1455,1464 ---- // if 'wildmode' first contains "longest", get longest // common part if (wim_flags[0] & WIM_LONGEST) ! res = nextwild(&xpc, WILD_LONGEST, options, firstc != '@'); else res = nextwild(&xpc, WILD_EXPAND_KEEP, options, ! firstc != '@'); // if interrupted while completing, behave like it failed if (got_int) *************** *** 1483,1489 **** wim_index = 1; if ((wim_flags[wim_index] & WIM_LIST) #ifdef FEAT_WILDMENU ! || (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0) #endif ) { --- 1483,1489 ---- wim_index = 1; if ((wim_flags[wim_index] & WIM_LIST) #ifdef FEAT_WILDMENU ! || (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0) #endif ) { *************** *** 1511,1518 **** nextwild(&xpc, WILD_LONGEST, options, firstc != '@'); else if (wim_flags[wim_index] & WIM_FULL) ! nextwild(&xpc, WILD_NEXT, options, ! firstc != '@'); } else vim_beep(BO_WILD); --- 1511,1517 ---- nextwild(&xpc, WILD_LONGEST, options, firstc != '@'); else if (wim_flags[wim_index] & WIM_FULL) ! nextwild(&xpc, WILD_NEXT, options, firstc != '@'); } else vim_beep(BO_WILD); *************** *** 2348,2354 **** trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED); #ifdef FEAT_SEARCH_EXTRA ! may_do_incsearch_highlighting(firstc, count, &is_state); #endif #ifdef FEAT_RIGHTLEFT --- 2347,2354 ---- trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED); #ifdef FEAT_SEARCH_EXTRA ! if (xpc.xp_context == EXPAND_NOTHING) ! may_do_incsearch_highlighting(firstc, count, &is_state); #endif #ifdef FEAT_RIGHTLEFT *** ../vim-8.2.1579/src/testdir/test_cmdline.vim 2020-08-12 18:50:31.875655822 +0200 --- src/testdir/test_cmdline.vim 2020-09-03 16:45:07.850397438 +0200 *************** *** 84,89 **** --- 84,117 ---- call delete('Xdir1', 'd') set nowildmenu endfunc + f + func Test_wildmenu_screendump() + CheckScreendump + + let lines =<< trim [SCRIPT] + set wildmenu hlsearch + [SCRIPT] + call writefile(lines, 'XTest_wildmenu') + + let buf = RunVimInTerminal('-S XTest_wildmenu', {'rows': 8}) + call term_sendkeys(buf, ":vim\") + call VerifyScreenDump(buf, 'Test_wildmenu_1', {}) + + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_2', {}) + + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_3', {}) + + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_4', {}) + call term_sendkeys(buf, "\") + + " clean up + call StopVimInTerminal(buf) + call delete('XTest_wildmenu') + endfunc + func Test_map_completion() CheckFeature cmdline_compl *** ../vim-8.2.1579/src/testdir/dumps/Test_wildmenu_1.dump 2020-09-03 16:49:34.757789339 +0200 --- src/testdir/dumps/Test_wildmenu_1.dump 2020-09-03 16:46:09.122260225 +0200 *************** *** 0 **** --- 1,8 ---- + | +0&#ffffff0@74 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |v+0#0000001#ffff4012|i|m|9|s|c|r|i|p|t| +3#0000000#ffffff0@1|v|i|m|g|r|e|p| @1|v|i|m|g|r|e|p|a|d@1| @43 + |:+0&&|v|i|m|9|s|c|r|i|p|t> @63 *** ../vim-8.2.1579/src/testdir/dumps/Test_wildmenu_2.dump 2020-09-03 16:49:34.761789328 +0200 --- src/testdir/dumps/Test_wildmenu_2.dump 2020-09-03 16:46:10.166257872 +0200 *************** *** 0 **** --- 1,8 ---- + | +0&#ffffff0@74 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v+0#0000001#ffff4012|i|m|g|r|e|p| +3#0000000#ffffff0@1|v|i|m|g|r|e|p|a|d@1| @43 + |:+0&&|v|i|m|g|r|e|p> @66 *** ../vim-8.2.1579/src/testdir/dumps/Test_wildmenu_3.dump 2020-09-03 16:49:34.765789319 +0200 --- src/testdir/dumps/Test_wildmenu_3.dump 2020-09-03 16:46:11.214255512 +0200 *************** *** 0 **** --- 1,8 ---- + | +0&#ffffff0@74 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v|i|m|g|r|e|p| @1|v+0#0000001#ffff4012|i|m|g|r|e|p|a|d@1| +3#0000000#ffffff0@43 + |:+0&&|v|i|m|g|r|e|p|a|d@1> @63 *** ../vim-8.2.1579/src/testdir/dumps/Test_wildmenu_4.dump 2020-09-03 16:49:34.769789310 +0200 --- src/testdir/dumps/Test_wildmenu_4.dump 2020-09-03 16:46:12.262253149 +0200 *************** *** 0 **** --- 1,8 ---- + | +0&#ffffff0@74 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v|i|m|g|r|e|p| @1|v|i|m|g|r|e|p|a|d@1| @43 + |:+0&&|v|i|m> @70 *** ../vim-8.2.1579/src/version.c 2020-09-03 16:04:25.972190623 +0200 --- src/version.c 2020-09-03 16:45:47.366309130 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1580, /**/ -- We do not stumble over mountains, but over molehills. Confucius /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///