Skip to content

Commit a60053b

Browse files
committed
patch 8.2.1580: wildmenu does not work properly
Problem: Wildmenu does not work properly. Solution: Do not call may_do_incsearch_highlighting() if completion is in progress.
1 parent 5b5aa11 commit a60053b

7 files changed

Lines changed: 74 additions & 12 deletions

File tree

src/ex_getln.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ may_do_incsearch_highlighting(
397397
// NOTE: must call restore_last_search_pattern() before returning!
398398
save_last_search_pattern();
399399

400-
if (!do_incsearch_highlighting(firstc, &search_delim, is_state, &skiplen, &patlen))
400+
if (!do_incsearch_highlighting(firstc, &search_delim, is_state,
401+
&skiplen, &patlen))
401402
{
402403
restore_last_search_pattern();
403404
finish_incsearch_highlighting(FALSE, is_state, TRUE);
@@ -1235,10 +1236,10 @@ getcmdline_int(
12351236
if (has_mbyte)
12361237
j -= (*mb_head_off)(ccline.cmdbuff, ccline.cmdbuff + j);
12371238
if (vim_ispathsep(ccline.cmdbuff[j])
1238-
#ifdef BACKSLASH_IN_FILENAME
1239+
# ifdef BACKSLASH_IN_FILENAME
12391240
&& vim_strchr((char_u *)" *?[{`$%#",
12401241
ccline.cmdbuff[j + 1]) == NULL
1241-
#endif
1242+
# endif
12421243
)
12431244
{
12441245
if (found)
@@ -1425,6 +1426,7 @@ getcmdline_int(
14251426
if ((c == p_wc && !gotesc && KeyTyped) || c == p_wcm)
14261427
{
14271428
int options = WILD_NO_BEEP;
1429+
14281430
if (wim_flags[wim_index] & WIM_BUFLASTUSED)
14291431
options |= WILD_BUFLASTUSED;
14301432
if (xpc.xp_numfiles > 0) // typed p_wc at least twice
@@ -1442,8 +1444,7 @@ getcmdline_int(
14421444
res = nextwild(&xpc, WILD_LONGEST, options,
14431445
firstc != '@');
14441446
else if (wim_flags[wim_index] & WIM_FULL)
1445-
res = nextwild(&xpc, WILD_NEXT, options,
1446-
firstc != '@');
1447+
res = nextwild(&xpc, WILD_NEXT, options, firstc != '@');
14471448
else
14481449
res = OK; // don't insert 'wildchar' now
14491450
}
@@ -1454,11 +1455,10 @@ getcmdline_int(
14541455
// if 'wildmode' first contains "longest", get longest
14551456
// common part
14561457
if (wim_flags[0] & WIM_LONGEST)
1457-
res = nextwild(&xpc, WILD_LONGEST, options,
1458-
firstc != '@');
1458+
res = nextwild(&xpc, WILD_LONGEST, options, firstc != '@');
14591459
else
14601460
res = nextwild(&xpc, WILD_EXPAND_KEEP, options,
1461-
firstc != '@');
1461+
firstc != '@');
14621462

14631463
// if interrupted while completing, behave like it failed
14641464
if (got_int)
@@ -1483,7 +1483,7 @@ getcmdline_int(
14831483
wim_index = 1;
14841484
if ((wim_flags[wim_index] & WIM_LIST)
14851485
#ifdef FEAT_WILDMENU
1486-
|| (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0)
1486+
|| (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0)
14871487
#endif
14881488
)
14891489
{
@@ -1511,8 +1511,7 @@ getcmdline_int(
15111511
nextwild(&xpc, WILD_LONGEST, options,
15121512
firstc != '@');
15131513
else if (wim_flags[wim_index] & WIM_FULL)
1514-
nextwild(&xpc, WILD_NEXT, options,
1515-
firstc != '@');
1514+
nextwild(&xpc, WILD_NEXT, options, firstc != '@');
15161515
}
15171516
else
15181517
vim_beep(BO_WILD);
@@ -2348,7 +2347,8 @@ getcmdline_int(
23482347
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED);
23492348

23502349
#ifdef FEAT_SEARCH_EXTRA
2351-
may_do_incsearch_highlighting(firstc, count, &is_state);
2350+
if (xpc.xp_context == EXPAND_NOTHING)
2351+
may_do_incsearch_highlighting(firstc, count, &is_state);
23522352
#endif
23532353

23542354
#ifdef FEAT_RIGHTLEFT
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
| +0&#ffffff0@74
2+
|~+0#4040ff13&| @73
3+
|~| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|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
8+
|:+0&&|v|i|m|9|s|c|r|i|p|t> @63
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
| +0&#ffffff0@74
2+
|~+0#4040ff13&| @73
3+
|~| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|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
8+
|:+0&&|v|i|m|g|r|e|p> @66
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
| +0&#ffffff0@74
2+
|~+0#4040ff13&| @73
3+
|~| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|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
8+
|:+0&&|v|i|m|g|r|e|p|a|d@1> @63
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
| +0&#ffffff0@74
2+
|~+0#4040ff13&| @73
3+
|~| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|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
8+
|:+0&&|v|i|m> @70

src/testdir/test_cmdline.vim

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,34 @@ func Test_complete_wildmenu()
8484
call delete('Xdir1', 'd')
8585
set nowildmenu
8686
endfunc
87+
f
88+
func Test_wildmenu_screendump()
89+
CheckScreendump
90+
91+
let lines =<< trim [SCRIPT]
92+
set wildmenu hlsearch
93+
[SCRIPT]
94+
call writefile(lines, 'XTest_wildmenu')
95+
96+
let buf = RunVimInTerminal('-S XTest_wildmenu', {'rows': 8})
97+
call term_sendkeys(buf, ":vim\<Tab>")
98+
call VerifyScreenDump(buf, 'Test_wildmenu_1', {})
99+
100+
call term_sendkeys(buf, "\<Tab>")
101+
call VerifyScreenDump(buf, 'Test_wildmenu_2', {})
102+
103+
call term_sendkeys(buf, "\<Tab>")
104+
call VerifyScreenDump(buf, 'Test_wildmenu_3', {})
105+
106+
call term_sendkeys(buf, "\<Tab>")
107+
call VerifyScreenDump(buf, 'Test_wildmenu_4', {})
108+
call term_sendkeys(buf, "\<Esc>")
109+
110+
" clean up
111+
call StopVimInTerminal(buf)
112+
call delete('XTest_wildmenu')
113+
endfunc
114+
87115

88116
func Test_map_completion()
89117
CheckFeature cmdline_compl

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1580,
757759
/**/
758760
1579,
759761
/**/

0 commit comments

Comments
 (0)