Skip to content

Commit 8fec92d

Browse files
girishjichrisbra
authored andcommitted
patch 9.1.1737: Patch v9.1.1714 introduce a regression for wildmenu
Problem: Patch v9.1.1714 introduce a regression for wildmenu (zeertzjq) Solution: Restore behavior of "longest" in 'wildmode' (Girish Palya) - Fixed a regression caused by PR #18125 selecting wrong item - Fixed another regression where the first pasted text did not appear on the command-line after starting Vim. closes: #18212 Signed-off-by: Girish Palya <girishji@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 6505dc6 commit 8fec92d

14 files changed

Lines changed: 118 additions & 33 deletions

src/ex_getln.c

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,10 @@ cmdline_wildchar_complete(
10001000

10011001
// Remove popup window if no completion items are available
10021002
if (redraw_if_menu_empty && xp->xp_numfiles <= 0)
1003+
{
10031004
update_screen(0);
1005+
redrawcmd(); // Ensure initial pasted text appears on cmdline
1006+
}
10041007

10051008
// if interrupted while completing, behave like it failed
10061009
if (got_int)
@@ -1016,16 +1019,29 @@ cmdline_wildchar_complete(
10161019
// Display matches
10171020
if (res == OK && xp->xp_numfiles > (wim_noselect ? 0 : 1))
10181021
{
1019-
// If "longest" fails to identify the longest item, try other
1020-
// 'wim' values if available
1021-
if (wim_longest && ccline.cmdpos == cmdpos_before)
1022+
if (wim_longest)
10221023
{
1023-
if (wim_full)
1024-
nextwild(xp, WILD_NEXT, options, escape);
1024+
int found_longest_prefix = (ccline.cmdpos != cmdpos_before);
10251025
if (wim_list || (p_wmnu && wim_full))
1026-
(void)showmatches(xp, p_wmnu, wim_list, FALSE);
1026+
(void)showmatches(xp, p_wmnu, wim_list, TRUE);
1027+
else if (!found_longest_prefix)
1028+
{
1029+
int wim_list_next = (wim_flags[1] & WIM_LIST);
1030+
int wim_full_next = (wim_flags[1] & WIM_FULL);
1031+
int wim_noselect_next = (wim_flags[1] & WIM_NOSELECT);
1032+
if (wim_list_next || (p_wmnu && (wim_full_next
1033+
|| wim_noselect_next)))
1034+
{
1035+
if (wim_noselect_next)
1036+
options |= WILD_NOSELECT;
1037+
if (wim_full_next || wim_noselect_next)
1038+
nextwild(xp, WILD_NEXT, options, escape);
1039+
(void)showmatches(xp, p_wmnu, wim_list_next,
1040+
wim_noselect_next);
1041+
}
1042+
}
10271043
}
1028-
else if (!wim_longest)
1044+
else
10291045
{
10301046
if (wim_list || (p_wmnu && (wim_full || wim_noselect)))
10311047
(void)showmatches(xp, p_wmnu, wim_list, wim_noselect);
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
| +0&#ffffff0@74
2-
|~+0#4040ff13&| @73
1+
|~+0#4040ff13#ffffff0| @73
32
|~| @73
43
|~| @73
54
|~| @73
65
|~| @73
76
|~| @73
8-
|~| @73
9-
|~| @73
10-
|:+0#0000000&|c|n> @71
7+
|:+0#0000000&|c|n| @71
8+
|c|n|e|w|e|r| @6|c|n|f|i|l|e| @6|c|n|o|r|e|m|a|p| @40
9+
|c|n|e|x|t| @7|c|n|o|r|e|a|b@1|r|e|v| @1|c|n|o|r|e|m|e|n|u| @39
10+
|:|c|n> @71

src/testdir/dumps/Test_wildmenu_pum_31.dump

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
|:+0#0000000&|c|n| @71
88
|c|n|e|w|e|r| @6|c|n|f|i|l|e| @6|c|n|o|r|e|m|a|p| @40
99
|c|n|e|x|t| @7|c|n|o|r|e|a|b@1|r|e|v| @1|c|n|o|r|e|m|e|n|u| @39
10-
|:|c|n> @71
10+
|:|c|n|s> @70
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
| +0&#ffffff0@74
2-
|~+0#4040ff13&| @73
1+
|~+0#4040ff13#ffffff0| @73
32
|~| @73
43
|~| @73
54
|~| @73
65
|~| @73
76
|~| @73
87
|~| @73
9-
|~| @73
10-
|:+0#0000000&|s|i|g|n| |u|n> @66
8+
|:+0#0000000&|s|i|g|n| |u|n| @66
9+
|u|n|d|e|f|i|n|e| @1|u|n|p|l|a|c|e| @57
10+
|:|s|i|g|n| |u|n> @66

src/testdir/dumps/Test_wildmenu_pum_58.dump

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
|~| @73
77
|~| @73
88
|~| @73
9-
|u+0#0000001#ffff4012|n|d|e|f|i|n|e| +3#0000000#ffffff0@1|u|n|p|l|a|c|e| @57
10-
|:+0&&|s|i|g|n| |u|n|d|e|f|i|n|e> @60
9+
|u+3#0000000&|n|d|e|f|i|n|e| @1|u|n|p|l|a|c|e| @57
10+
|:+0&&|s|i|g|n| |u|n> @66
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
| +0&#ffffff0@74
2+
|~+0#4040ff13&| @73
3+
|~| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|~| @73
8+
|~| @73
9+
|u+0#0000001#ffff4012|n|d|e|f|i|n|e| +3#0000000#ffffff0@1|u|n|p|l|a|c|e| @57
10+
|:+0&&|s|i|g|n| |u|n|d|e|f|i|n|e> @60
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
| +0&#ffffff0@74
2+
|~+0#4040ff13&| @73
3+
|~| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|~| @73
8+
|~| @73
9+
|c+3#0000000&|n|e|w|e|r| @1|c|n|e|x|t| @1|c|n|f|i|l|e| @1|c|n|o|r|e|a|b@1|r|e|v| @1|c|n|o|r|e|m|a|p| @1|c|n|o|r|e|m|e|n|u| @19
10+
|:+0&&|c|n> @71
File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
| +0&#ffffff0@74
2+
|~+0#4040ff13&| @73
3+
|~| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|~| @73
8+
|~| @73
9+
|~| @73
10+
|:+0#0000000&|s|i|g|n| |u|n> @66
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
| +0&#ffffff0@74
2+
|~+0#4040ff13&| @73
3+
|~| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|~| @73
8+
|~| @73
9+
|u+0#0000001#ffff4012|n|d|e|f|i|n|e| +3#0000000#ffffff0@1|u|n|p|l|a|c|e| @57
10+
|:+0&&|s|i|g|n| |u|n|d|e|f|i|n|e> @60

0 commit comments

Comments
 (0)