0
0
mirror of https://github.com/vim/vim.git synced 2025-10-23 08:44:20 -04:00

patch 9.1.1740: Memory leak with wildmode=longest,full and wildoptions=pum

Problem:  Memory leak with wildmode=longest,full and wildoptions=pum
          (after 9.1.1737).
Solution: Avoid using showmatches() and WILD_NEXT together.  Also fix
          wildmode=longest,noselect:full selecting wrong item
          (zeertzjq).

fixes: #18228
closes: #18229

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-09-07 17:17:39 +02:00
committed by Christian Brabandt
parent 1ed2ff77d8
commit c7f235bd43
4 changed files with 33 additions and 5 deletions

View File

@@ -1032,10 +1032,9 @@ cmdline_wildchar_complete(
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)
if (wim_full_next && !wim_noselect_next)
nextwild(xp, WILD_NEXT, options, escape);
else
(void)showmatches(xp, p_wmnu, wim_list_next,
wim_noselect_next);
if (wim_list_next)

View File

@@ -0,0 +1,10 @@
| +0&#ffffff0@74
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @3| +0#0000001#ffd7ff255|u|n|d|e|f|i|n|e| @6| +0#4040ff13#ffffff0@53
|~| @3| +0#0000001#ffd7ff255|u|n|p|l|a|c|e| @7| +0#4040ff13#ffffff0@53
|:+0#0000000&|s|i|g|n| |u|n> @66

View File

@@ -2973,6 +2973,23 @@ func Test_wildmenu_pum()
call term_sendkeys(buf, ":cn\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_pum_64', {})
" If "longest" finds no candidate in "longest,full", "full" is used
call term_sendkeys(buf, "\<Esc>:set wildmode=longest,full\<CR>")
call term_sendkeys(buf, ":set wildoptions=pum\<CR>")
call term_sendkeys(buf, ":sign un\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_pum_09', {})
call term_sendkeys(buf, "\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_pum_10', {})
" Similarly for "longest,noselect:full"
call term_sendkeys(buf, "\<Esc>:set wildmode=longest,noselect:full\<CR>")
call term_sendkeys(buf, ":sign un\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_pum_65', {})
call term_sendkeys(buf, "\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_pum_09', {})
call term_sendkeys(buf, "\<Tab>")
call VerifyScreenDump(buf, 'Test_wildmenu_pum_10', {})
call term_sendkeys(buf, "\<C-U>\<Esc>")
call StopVimInTerminal(buf)
endfunc

View File

@@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1740,
/**/
1739,
/**/