mirror of
https://github.com/vim/vim.git
synced 2025-10-21 08:24:06 -04:00
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>
This commit is contained in:
committed by
Christian Brabandt
parent
6505dc69d3
commit
8fec92d631
@@ -1000,7 +1000,10 @@ cmdline_wildchar_complete(
|
||||
|
||||
// Remove popup window if no completion items are available
|
||||
if (redraw_if_menu_empty && xp->xp_numfiles <= 0)
|
||||
{
|
||||
update_screen(0);
|
||||
redrawcmd(); // Ensure initial pasted text appears on cmdline
|
||||
}
|
||||
|
||||
// if interrupted while completing, behave like it failed
|
||||
if (got_int)
|
||||
@@ -1016,16 +1019,29 @@ cmdline_wildchar_complete(
|
||||
// Display matches
|
||||
if (res == OK && xp->xp_numfiles > (wim_noselect ? 0 : 1))
|
||||
{
|
||||
// If "longest" fails to identify the longest item, try other
|
||||
// 'wim' values if available
|
||||
if (wim_longest && ccline.cmdpos == cmdpos_before)
|
||||
if (wim_longest)
|
||||
{
|
||||
if (wim_full)
|
||||
nextwild(xp, WILD_NEXT, options, escape);
|
||||
int found_longest_prefix = (ccline.cmdpos != cmdpos_before);
|
||||
if (wim_list || (p_wmnu && wim_full))
|
||||
(void)showmatches(xp, p_wmnu, wim_list, FALSE);
|
||||
(void)showmatches(xp, p_wmnu, wim_list, TRUE);
|
||||
else if (!found_longest_prefix)
|
||||
{
|
||||
int wim_list_next = (wim_flags[1] & WIM_LIST);
|
||||
int wim_full_next = (wim_flags[1] & WIM_FULL);
|
||||
int wim_noselect_next = (wim_flags[1] & WIM_NOSELECT);
|
||||
if (wim_list_next || (p_wmnu && (wim_full_next
|
||||
|| wim_noselect_next)))
|
||||
{
|
||||
if (wim_noselect_next)
|
||||
options |= WILD_NOSELECT;
|
||||
if (wim_full_next || wim_noselect_next)
|
||||
nextwild(xp, WILD_NEXT, options, escape);
|
||||
(void)showmatches(xp, p_wmnu, wim_list_next,
|
||||
wim_noselect_next);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!wim_longest)
|
||||
else
|
||||
{
|
||||
if (wim_list || (p_wmnu && (wim_full || wim_noselect)))
|
||||
(void)showmatches(xp, p_wmnu, wim_list, wim_noselect);
|
||||
|
@@ -1,10 +1,10 @@
|
||||
| +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~+0#4040ff13#ffffff0| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|:+0#0000000&|c|n> @71
|
||||
|:+0#0000000&|c|n| @71
|
||||
|c|n|e|w|e|r| @6|c|n|f|i|l|e| @6|c|n|o|r|e|m|a|p| @40
|
||||
|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
|
||||
|:|c|n> @71
|
||||
|
@@ -7,4 +7,4 @@
|
||||
|:+0#0000000&|c|n| @71
|
||||
|c|n|e|w|e|r| @6|c|n|f|i|l|e| @6|c|n|o|r|e|m|a|p| @40
|
||||
|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
|
||||
|:|c|n> @71
|
||||
|:|c|n|s> @70
|
||||
|
@@ -1,10 +1,10 @@
|
||||
| +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~+0#4040ff13#ffffff0| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|:+0#0000000&|s|i|g|n| |u|n> @66
|
||||
|:+0#0000000&|s|i|g|n| |u|n| @66
|
||||
|u|n|d|e|f|i|n|e| @1|u|n|p|l|a|c|e| @57
|
||||
|:|s|i|g|n| |u|n> @66
|
||||
|
@@ -6,5 +6,5 @@
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|u+0#0000001#ffff4012|n|d|e|f|i|n|e| +3#0000000#ffffff0@1|u|n|p|l|a|c|e| @57
|
||||
|:+0&&|s|i|g|n| |u|n|d|e|f|i|n|e> @60
|
||||
|u+3#0000000&|n|d|e|f|i|n|e| @1|u|n|p|l|a|c|e| @57
|
||||
|:+0&&|s|i|g|n| |u|n> @66
|
||||
|
10
src/testdir/dumps/Test_wildmenu_pum_59.dump
Normal file
10
src/testdir/dumps/Test_wildmenu_pum_59.dump
Normal file
@@ -0,0 +1,10 @@
|
||||
| +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|u+0#0000001#ffff4012|n|d|e|f|i|n|e| +3#0000000#ffffff0@1|u|n|p|l|a|c|e| @57
|
||||
|:+0&&|s|i|g|n| |u|n|d|e|f|i|n|e> @60
|
10
src/testdir/dumps/Test_wildmenu_pum_60.dump
Normal file
10
src/testdir/dumps/Test_wildmenu_pum_60.dump
Normal file
@@ -0,0 +1,10 @@
|
||||
| +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|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
|
||||
|:+0&&|c|n> @71
|
10
src/testdir/dumps/Test_wildmenu_pum_62.dump
Normal file
10
src/testdir/dumps/Test_wildmenu_pum_62.dump
Normal file
@@ -0,0 +1,10 @@
|
||||
| +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|:+0#0000000&|s|i|g|n| |u|n> @66
|
10
src/testdir/dumps/Test_wildmenu_pum_63.dump
Normal file
10
src/testdir/dumps/Test_wildmenu_pum_63.dump
Normal file
@@ -0,0 +1,10 @@
|
||||
| +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|u+0#0000001#ffff4012|n|d|e|f|i|n|e| +3#0000000#ffffff0@1|u|n|p|l|a|c|e| @57
|
||||
|:+0&&|s|i|g|n| |u|n|d|e|f|i|n|e> @60
|
10
src/testdir/dumps/Test_wildmenu_pum_64.dump
Normal file
10
src/testdir/dumps/Test_wildmenu_pum_64.dump
Normal file
@@ -0,0 +1,10 @@
|
||||
| +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|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
|
||||
|:+0&&|c|n> @71
|
@@ -7,4 +7,4 @@
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|:+0#0000000&|T|e|s|t|C|m|d| |a|x> @45|0|,|0|-|1| @8|A|l@1|
|
||||
|:+0#0000000&|T|e|s|t|C|m|d| |a|x> @63
|
||||
|
@@ -2829,7 +2829,7 @@ func Test_wildmenu_pum()
|
||||
call term_sendkeys(buf, "\<C-U>set wildmode=longest,list\<CR>")
|
||||
call term_sendkeys(buf, ":cn\<Tab>")
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_30', {})
|
||||
call term_sendkeys(buf, "\<Tab>")
|
||||
call term_sendkeys(buf, "s")
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {})
|
||||
|
||||
" Tests a directory name contained full-width characters.
|
||||
@@ -2931,28 +2931,45 @@ func Test_wildmenu_pum()
|
||||
|
||||
call term_sendkeys(buf, "\<Esc>:set showtabline& laststatus& lazyredraw&\<CR>")
|
||||
|
||||
" Verify that if "longest" finds nothing, wildmenu is still shown
|
||||
call term_sendkeys(buf, ":set wildmode=longest:full,full wildoptions&\<CR>")
|
||||
call term_sendkeys(buf, ":cn\<Tab>")
|
||||
call TermWait(buf, 50)
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_54', {})
|
||||
|
||||
" Verify that if "longest" finds nothing, "list" is still shown
|
||||
call term_sendkeys(buf, "\<Esc>:set wildmode=longest:list,full\<CR>")
|
||||
" "longest:list" shows list whether it finds a candidate or not
|
||||
call term_sendkeys(buf, ":set wildmode=longest:list,full wildoptions&\<CR>")
|
||||
call term_sendkeys(buf, ":cn\<Tab>")
|
||||
call TermWait(buf, 50)
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_55', {})
|
||||
call term_sendkeys(buf, "\<Tab>")
|
||||
call TermWait(buf, 50)
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_56', {})
|
||||
|
||||
" Verify that if "longest" finds a candidate, wildmenu is not shown
|
||||
call term_sendkeys(buf, "\<Esc>:set wildmode=longest:full,full wildoptions&\<CR>")
|
||||
call term_sendkeys(buf, ":sign u\<Tab>")
|
||||
call term_sendkeys(buf, "\<Esc>:sign u\<Tab>")
|
||||
call TermWait(buf, 50)
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_57', {})
|
||||
|
||||
" "longest:full" shows wildmenu whether it finds a candidate or not; item not selected
|
||||
call term_sendkeys(buf, "\<Esc>:set wildmode=longest:full,full\<CR>")
|
||||
call term_sendkeys(buf, ":sign u\<Tab>")
|
||||
call TermWait(buf, 50)
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_58', {})
|
||||
call term_sendkeys(buf, "\<Tab>")
|
||||
call TermWait(buf, 50)
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_59', {})
|
||||
call term_sendkeys(buf, "\<Esc>:cn\<Tab>")
|
||||
call TermWait(buf, 50)
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_60', {})
|
||||
call term_sendkeys(buf, "\<Tab>")
|
||||
call TermWait(buf, 50)
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_61', {})
|
||||
|
||||
" If "longest,full" finds a candidate, wildmenu is not shown
|
||||
call term_sendkeys(buf, "\<Esc>:set wildmode=longest,full\<CR>")
|
||||
call term_sendkeys(buf, ":sign u\<Tab>")
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_62', {})
|
||||
" Subsequent wildchar shows wildmenu
|
||||
call term_sendkeys(buf, "\<Tab>")
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_58', {})
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_63', {})
|
||||
|
||||
" 'longest' does not find candidate, and displays menu without selecting item
|
||||
call term_sendkeys(buf, "\<Esc>:set wildmode=longest,noselect\<CR>")
|
||||
call term_sendkeys(buf, ":cn\<Tab>")
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_64', {})
|
||||
|
||||
call term_sendkeys(buf, "\<C-U>\<Esc>")
|
||||
call StopVimInTerminal(buf)
|
||||
|
@@ -724,6 +724,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1737,
|
||||
/**/
|
||||
1736,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user