mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
Merge pull request #8008 from bfredl/arrayfree
ex_getln: clear cmdline_block after it's freed
This commit is contained in:
commit
77286915a8
@ -194,7 +194,8 @@ static int cmd_showtail; /* Only show path tail in lists ? */
|
||||
|
||||
static int new_cmdpos; /* position set by set_cmdline_pos() */
|
||||
|
||||
static Array cmdline_block; ///< currently displayed block of context
|
||||
/// currently displayed block of context
|
||||
static Array cmdline_block = ARRAY_DICT_INIT;
|
||||
|
||||
/*
|
||||
* Type used by call_user_expand_func
|
||||
@ -2990,6 +2991,7 @@ void ui_ext_cmdline_block_append(int indent, const char *line)
|
||||
void ui_ext_cmdline_block_leave(void)
|
||||
{
|
||||
api_free_array(cmdline_block);
|
||||
cmdline_block = (Array)ARRAY_DICT_INIT;
|
||||
ui_call_cmdline_block_hide();
|
||||
}
|
||||
|
||||
|
@ -348,6 +348,35 @@ describe('external cmdline', function()
|
||||
{ { {}, ' line1'} } }, block)
|
||||
end)
|
||||
|
||||
feed('endfunction<cr>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq(nil, block)
|
||||
end)
|
||||
|
||||
-- Try once more, to check buffer is reinitialized. #8007
|
||||
feed(':function Bar()<cr>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq({{
|
||||
content = { { {}, "" } },
|
||||
firstc = ":",
|
||||
indent = 2,
|
||||
pos = 0,
|
||||
prompt = "",
|
||||
}}, cmdline)
|
||||
eq({ { { {}, 'function Bar()'} } }, block)
|
||||
end)
|
||||
|
||||
feed('endfunction<cr>')
|
||||
screen:expect([[
|
||||
|
Loading…
Reference in New Issue
Block a user