mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
vim-patch:9.1.1331: Leaking memory with cmdcomplete()
Problem: Leaking memory with cmdcomplete()
(zeertzjq, after v9.1.1329)
Solution: free the memory (Girish Palya)
closes: vim/vim#17190
5c3d1e3258
Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
2
runtime/doc/builtin.txt
generated
2
runtime/doc/builtin.txt
generated
@@ -1061,7 +1061,7 @@ clearmatches([{win}]) *clearmatches()*
|
|||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {win} (`integer?`)
|
• {win} (`integer?`)
|
||||||
|
|
||||||
cmdcomplete_info([{what}]) *cmdcomplete_info()*
|
cmdcomplete_info() *cmdcomplete_info()*
|
||||||
Returns a |Dictionary| with information about cmdline
|
Returns a |Dictionary| with information about cmdline
|
||||||
completion. See |cmdline-completion|.
|
completion. See |cmdline-completion|.
|
||||||
The items are:
|
The items are:
|
||||||
|
@@ -1065,6 +1065,7 @@ int showmatches(expand_T *xp, bool wildmenu)
|
|||||||
|
|
||||||
// Save cmdline before expansion
|
// Save cmdline before expansion
|
||||||
if (ccline->cmdbuff != NULL) {
|
if (ccline->cmdbuff != NULL) {
|
||||||
|
xfree(cmdline_orig);
|
||||||
cmdline_orig = xstrnsave(ccline->cmdbuff, (size_t)ccline->cmdlen);
|
cmdline_orig = xstrnsave(ccline->cmdbuff, (size_t)ccline->cmdlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1279,7 +1279,7 @@ M.funcs = {
|
|||||||
name = 'cmdcomplete_info',
|
name = 'cmdcomplete_info',
|
||||||
params = {},
|
params = {},
|
||||||
returns = 'table<string,any>',
|
returns = 'table<string,any>',
|
||||||
signature = 'cmdcomplete_info([{what}])',
|
signature = 'cmdcomplete_info()',
|
||||||
},
|
},
|
||||||
col = {
|
col = {
|
||||||
args = { 1, 2 },
|
args = { 1, 2 },
|
||||||
|
@@ -1302,8 +1302,8 @@ static int command_line_execute(VimState *state, int key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trigger CmdlineLeavePre autocommand
|
// Trigger CmdlineLeavePre autocommand
|
||||||
if (ccline.cmdfirstc != NUL && (s->c == '\n' || s->c == '\r' || s->c == K_KENTER
|
if (s->c == '\n' || s->c == '\r' || s->c == K_KENTER
|
||||||
|| s->c == ESC || s->c == Ctrl_C)) {
|
|| s->c == ESC || s->c == Ctrl_C) {
|
||||||
trigger_cmd_autocmd(get_cmdline_type(), EVENT_CMDLINELEAVEPRE);
|
trigger_cmd_autocmd(get_cmdline_type(), EVENT_CMDLINELEAVEPRE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1959,6 +1959,12 @@ func Test_Cmdline_Trigger()
|
|||||||
call assert_equal('', g:log)
|
call assert_equal('', g:log)
|
||||||
call feedkeys(":echo hello", "tx")
|
call feedkeys(":echo hello", "tx")
|
||||||
call assert_equal('CmdlineLeavePre', g:log)
|
call assert_equal('CmdlineLeavePre', g:log)
|
||||||
|
let g:count = 0
|
||||||
|
autocmd CmdlineLeavePre * let g:count += 1
|
||||||
|
call feedkeys(":let c = input('? ')\<cr>B\<cr>", "tx")
|
||||||
|
call assert_equal(2, g:count)
|
||||||
|
unlet! g:count
|
||||||
|
unlet! g:log
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user