Mercurial > vim
diff src/testdir/test_mapping.vim @ 31077:6a2b04cd0213 v9.0.0873
patch 9.0.0873: using freed memory when executing mapclear at more prompt
Commit: https://github.com/vim/vim/commit/bf533e4e88ebac8b8fec6d3e12dadc476ce9a1df
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 13 20:43:19 2022 +0000
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 https://github.com/vim/vim/issues/11438)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Nov 2022 21:45:03 +0100 |
parents | 1b194361b71a |
children | ee50174810ac |
line wrap: on
line diff
--- a/src/testdir/test_mapping.vim +++ b/src/testdir/test_mapping.vim @@ -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