diff src/testdir/test_popupwin.vim @ 22367:997bbc35c181 v8.2.1732

patch 8.2.1732: stuck when win_execute() for a popup causes an error Commit: https://github.com/vim/vim/commit/6bf1b52ba2816dffdbd0d994320abfb1586bf666 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 23 17:41:26 2020 +0200 patch 8.2.1732: stuck when win_execute() for a popup causes an error Problem: Stuck when win_execute() for a popup causes an error. Solution: Disable the filter callback on error. (issue https://github.com/vim/vim/issues/6999)
author Bram Moolenaar <Bram@vim.org>
date Wed, 23 Sep 2020 17:45:03 +0200
parents 00f2eebe74d9
children b2cb2a321af9
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -1556,6 +1556,30 @@ func Test_popup_filter_normal_cmd()
   call delete('XtestPopupNormal')
 endfunc
 
+" this tests that we don't get stuck with an error in "win_execute()"
+func Test_popup_filter_win_execute()
+  CheckScreendump
+
+  let lines =<< trim END
+      let g:winid = popup_create('some text', {'filter': 'invalidfilter'})
+      call timer_start(0, {-> win_execute(g:winid, 'invalidCommand')})
+  END
+  call writefile(lines, 'XtestPopupWinExecute')
+  let buf = RunVimInTerminal('-S XtestPopupWinExecute', #{rows: 10, wait_for_ruler: 0})
+
+  call WaitFor({-> term_getline(buf, 9) =~ 'Not an editor command: invalidCommand'})
+  call term_sendkeys(buf, "\<CR>")
+  call WaitFor({-> term_getline(buf, 9) =~ 'Unknown function: invalidfilter'})
+  call term_sendkeys(buf, "\<CR>")
+  call WaitFor({-> term_getline(buf, 9) =~ 'Not allowed in a popup window'})
+  call term_sendkeys(buf, "\<CR>")
+  call term_sendkeys(buf, "\<CR>")
+  call VerifyScreenDump(buf, 'Test_popupwin_win_execute', {})
+
+  call StopVimInTerminal(buf)
+  call delete('XtestPopupWinExecute')
+endfunc
+
 func ShowDialog(key, result)
   let s:cb_res = 999
   let winid = popup_dialog('do you want to quit (Yes/no)?', #{