diff src/testdir/test_cmdline.vim @ 31394:a6b1f1c22374 v9.0.1030

patch 9.0.1030: using freed memory with the cmdline popup menu Commit: https://github.com/vim/vim/commit/038e6d20e680ce8c850d07f6b035c4e1904c1201 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 8 12:00:50 2022 +0000 patch 9.0.1030: using freed memory with the cmdline popup menu Problem: Using freed memory with the cmdline popup menu. Solution: Clear the popup menu when clearing the matches. (closes https://github.com/vim/vim/issues/11677)
author Bram Moolenaar <Bram@vim.org>
date Thu, 08 Dec 2022 13:15:03 +0100
parents b0596e8ee3c0
children a5561303189e
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -2485,6 +2485,21 @@ func Test_wildmenu_pum_from_terminal()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_wildmenu_pum_clear_entries()
+  " This was using freed memory.  Run in a terminal to get the pum to update.
+  let lines =<< trim END
+    set wildoptions=pum
+    set wildchar=<C-E>
+  END
+  call writefile(lines, 'XwildmenuTest', 'D')
+  let buf = RunVimInTerminal('-S XwildmenuTest', #{rows: 10})
+
+  call term_sendkeys(buf, ":\<C-E>\<C-E>")
+  call VerifyScreenDump(buf, 'Test_wildmenu_pum_clear_entries_1', {})
+
+  set wildoptions& wildchar&
+endfunc
+
 " Test for completion after a :substitute command followed by a pipe (|)
 " character
 func Test_cmdline_complete_substitute()