1
0
forked from aniani/vim

patch 9.0.0873: using freed memory when executing mapclear at more prompt

Problem:    Using freed memory when executing mapclear at the more prompt.
Solution:   Do not clear mappings while listing them. (closes #11438)
This commit is contained in:
Bram Moolenaar
2022-11-13 20:43:19 +00:00
parent 623e94e138
commit bf533e4e88
4 changed files with 63 additions and 1 deletions

View File

@@ -1774,5 +1774,29 @@ func Test_using_past_typeahead()
nunmap :00
endfunc
func Test_mapclear_while_listing()
CheckRunVimInTerminal
let lines =<< trim END
set nocompatible
mapclear
for i in range(1, 999)
exe 'map ' .. 'foo' .. i .. ' bar'
endfor
au CmdlineLeave : call timer_start(0, {-> execute('mapclear')})
END
call writefile(lines, 'Xmapclear', 'D')
let buf = RunVimInTerminal('-S Xmapclear', {'rows': 10})
" this was using freed memory
call term_sendkeys(buf, ":map\<CR>")
call TermWait(buf, 50)
call term_sendkeys(buf, "G")
call TermWait(buf, 50)
call term_sendkeys(buf, "\<CR>")
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab