comparison 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
comparison
equal deleted inserted replaced
31076:d6352b62935d 31077:6a2b04cd0213
1772 1772
1773 exe "norm :set \x80\xfb0=\<CR>" 1773 exe "norm :set \x80\xfb0=\<CR>"
1774 nunmap :00 1774 nunmap :00
1775 endfunc 1775 endfunc
1776 1776
1777 func Test_mapclear_while_listing()
1778 CheckRunVimInTerminal
1779
1780 let lines =<< trim END
1781 set nocompatible
1782 mapclear
1783 for i in range(1, 999)
1784 exe 'map ' .. 'foo' .. i .. ' bar'
1785 endfor
1786 au CmdlineLeave : call timer_start(0, {-> execute('mapclear')})
1787 END
1788 call writefile(lines, 'Xmapclear', 'D')
1789 let buf = RunVimInTerminal('-S Xmapclear', {'rows': 10})
1790
1791 " this was using freed memory
1792 call term_sendkeys(buf, ":map\<CR>")
1793 call TermWait(buf, 50)
1794 call term_sendkeys(buf, "G")
1795 call TermWait(buf, 50)
1796 call term_sendkeys(buf, "\<CR>")
1797
1798 call StopVimInTerminal(buf)
1799 endfunc
1800
1777 1801
1778 " vim: shiftwidth=2 sts=2 expandtab 1802 " vim: shiftwidth=2 sts=2 expandtab