]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1737: Patch v9.1.1714 introduce a regression for wildmenu v9.1.1737
authorGirish Palya <girishji@gmail.com>
Sat, 6 Sep 2025 17:39:32 +0000 (19:39 +0200)
committerChristian Brabandt <cb@256bit.org>
Sat, 6 Sep 2025 17:39:32 +0000 (19:39 +0200)
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>
14 files changed:
src/ex_getln.c
src/testdir/dumps/Test_wildmenu_pum_30.dump
src/testdir/dumps/Test_wildmenu_pum_31.dump
src/testdir/dumps/Test_wildmenu_pum_57.dump
src/testdir/dumps/Test_wildmenu_pum_58.dump
src/testdir/dumps/Test_wildmenu_pum_59.dump [new file with mode: 0644]
src/testdir/dumps/Test_wildmenu_pum_60.dump [new file with mode: 0644]
src/testdir/dumps/Test_wildmenu_pum_61.dump [moved from src/testdir/dumps/Test_wildmenu_pum_54.dump with 100% similarity]
src/testdir/dumps/Test_wildmenu_pum_62.dump [new file with mode: 0644]
src/testdir/dumps/Test_wildmenu_pum_63.dump [new file with mode: 0644]
src/testdir/dumps/Test_wildmenu_pum_64.dump [new file with mode: 0644]
src/testdir/dumps/Test_wildtrigger_update_screen_3.dump
src/testdir/test_cmdline.vim
src/version.c

index 794075c57eefa249875bacfbe442b8a19e675644..a7f957eab48e2ad817da7dcf6432ce4ffd446323 100644 (file)
@@ -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);
index 732e8a8ac070e40dd6fccfd8a0bf18e895972574..76e4780ea2ed4adba37a3bee3480f1f7f855ae94 100644 (file)
@@ -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
index 76e4780ea2ed4adba37a3bee3480f1f7f855ae94..157f16c89c1335cfbdc13f67fe19f082f6bdb4ec 100644 (file)
@@ -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
index 73547387ebe260c061a909b9b4551b1a4a2c0dd9..f67557a891081f6198823a524663f8cb34597955 100644 (file)
@@ -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
index 4170891a48f61f082c152d903312aa1b5bf13f58..a53c0cebb0444af204ff52d2e98d796865457740 100644 (file)
@@ -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
diff --git a/src/testdir/dumps/Test_wildmenu_pum_59.dump b/src/testdir/dumps/Test_wildmenu_pum_59.dump
new file mode 100644 (file)
index 0000000..4170891
--- /dev/null
@@ -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
diff --git a/src/testdir/dumps/Test_wildmenu_pum_60.dump b/src/testdir/dumps/Test_wildmenu_pum_60.dump
new file mode 100644 (file)
index 0000000..d0bd039
--- /dev/null
@@ -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
diff --git a/src/testdir/dumps/Test_wildmenu_pum_62.dump b/src/testdir/dumps/Test_wildmenu_pum_62.dump
new file mode 100644 (file)
index 0000000..7354738
--- /dev/null
@@ -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
diff --git a/src/testdir/dumps/Test_wildmenu_pum_63.dump b/src/testdir/dumps/Test_wildmenu_pum_63.dump
new file mode 100644 (file)
index 0000000..4170891
--- /dev/null
@@ -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
diff --git a/src/testdir/dumps/Test_wildmenu_pum_64.dump b/src/testdir/dumps/Test_wildmenu_pum_64.dump
new file mode 100644 (file)
index 0000000..d0bd039
--- /dev/null
@@ -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
index 836ea6d15b5e3eab866feddaadf7fdac78327fa4..d936b1aa27a510ee984f1e006b013776e89e2af4 100644 (file)
@@ -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
index 84234b803c75764a6a359306c4ef4505e49dc9b2..09dfa3e93bd64ca720637494abc93c1d81bab775 100644 (file)
@@ -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', {})
+  call term_sendkeys(buf, "\<Esc>:sign u\<Tab>")
+  call TermWait(buf, 50)
+  call VerifyScreenDump(buf, 'Test_wildmenu_pum_57', {})
 
-  " Verify that if "longest" finds a candidate, wildmenu is not shown
-  call term_sendkeys(buf, "\<Esc>:set wildmode=longest:full,full wildoptions&\<CR>")
+  " "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 VerifyScreenDump(buf, 'Test_wildmenu_pum_57', {})
+  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)
index cf2f9910168946e9506bc1b599aaef8ef1fc5c6c..596cd17dd81cc0407ebb95b5b3e62c68f625dc97 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1737,
 /**/
     1736,
 /**/