mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 17:28:23 +00:00
vim-patch:9.0.1030: using freed memory with the cmdline popup menu
Problem: Using freed memory with the cmdline popup menu.
Solution: Clear the popup menu when clearing the matches. (closes vim/vim#11677)
038e6d20e6
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -745,6 +745,11 @@ char *ExpandOne(expand_T *xp, char *str, char *orig, int options, int mode)
|
|||||||
FreeWild(xp->xp_numfiles, xp->xp_files);
|
FreeWild(xp->xp_numfiles, xp->xp_files);
|
||||||
xp->xp_numfiles = -1;
|
xp->xp_numfiles = -1;
|
||||||
XFREE_CLEAR(orig_save);
|
XFREE_CLEAR(orig_save);
|
||||||
|
|
||||||
|
// The entries from xp_files may be used in the PUM, remove it.
|
||||||
|
if (compl_match_array != NULL) {
|
||||||
|
cmdline_pum_remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
findex = 0;
|
findex = 0;
|
||||||
|
|
||||||
|
@@ -2281,6 +2281,21 @@ func Test_wildmenu_pum()
|
|||||||
call delete('Xdir', 'rf')
|
call delete('Xdir', 'rf')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_wildmenu_pum_clear_entries()
|
||||||
|
" This was using freed memory. Run in a terminal to get the pum to update.
|
||||||
|
let lines =<< trim END
|
||||||
|
set wildoptions=pum
|
||||||
|
set wildchar=<C-E>
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XwildmenuTest', 'D')
|
||||||
|
let buf = RunVimInTerminal('-S XwildmenuTest', #{rows: 10})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":\<C-E>\<C-E>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_wildmenu_pum_clear_entries_1', {})
|
||||||
|
|
||||||
|
set wildoptions& wildchar&
|
||||||
|
endfunc
|
||||||
|
|
||||||
" this was going over the end of IObuff
|
" this was going over the end of IObuff
|
||||||
func Test_report_error_with_composing()
|
func Test_report_error_with_composing()
|
||||||
let caught = 'no'
|
let caught = 'no'
|
||||||
|
@@ -2583,6 +2583,29 @@ describe('builtin popupmenu', function()
|
|||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- oldtest: Test_wildmenu_pum_clear_entries()
|
||||||
|
it('wildoptions=pum when using Ctrl-E as wildchar vim-patch:9.0.1030', function()
|
||||||
|
screen:try_resize(30, 10)
|
||||||
|
exec([[
|
||||||
|
set wildoptions=pum
|
||||||
|
set wildchar=<C-E>
|
||||||
|
]])
|
||||||
|
feed(':sign <C-E><C-E>')
|
||||||
|
screen:expect([[
|
||||||
|
|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }{s: define }{1: }|
|
||||||
|
{1:~ }{n: jump }{1: }|
|
||||||
|
{1:~ }{n: list }{1: }|
|
||||||
|
{1:~ }{n: place }{1: }|
|
||||||
|
{1:~ }{n: undefine }{1: }|
|
||||||
|
{1:~ }{n: unplace }{1: }|
|
||||||
|
:sign define^ |
|
||||||
|
]])
|
||||||
|
assert_alive()
|
||||||
|
end)
|
||||||
|
|
||||||
it("'pumblend' RGB-color", function()
|
it("'pumblend' RGB-color", function()
|
||||||
screen:try_resize(60,14)
|
screen:try_resize(60,14)
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
|
Reference in New Issue
Block a user