diff src/testdir/test_terminal.vim @ 19312:18fc30542bf5 v8.2.0214

patch 8.2.0214: a popup window with a terminal can be made hidden Commit: https://github.com/vim/vim/commit/2e6638d5f03ae183999c726ba63e528d556342c0 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 5 21:07:18 2020 +0100 patch 8.2.0214: a popup window with a terminal can be made hidden Problem: A popup window with a terminal can be made hidden. Solution: Disallow hiding a terminal popup.
author Bram Moolenaar <Bram@vim.org>
date Wed, 05 Feb 2020 21:15:04 +0100
parents a4b65930a0dc
children 673a95ef80af
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -2337,12 +2337,15 @@ func Test_terminal_in_popup()
 	\ 'hi PopTerm ctermbg=grey',
 	\ 'func OpenTerm(setColor)',
 	\ "  let buf = term_start('" .. cmd .. " Xtext', #{hidden: 1, term_finish: 'close'})",
-	\ '  let winid = popup_create(buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})',
+	\ '  let s:winid = popup_create(buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})',
 	\ '  if a:setColor',
-	\ '    call win_execute(winid, "set wincolor=PopTerm")',
+	\ '    call win_execute(s:winid, "set wincolor=PopTerm")',
 	\ '  endif',
 	\ 'endfunc',
 	\ 'call OpenTerm(0)',
+	\ 'func HidePopup()',
+	\ '  call popup_hide(s:winid)',
+	\ 'endfunc',
 	\ ]
   call writefile(lines, 'XtermPopup')
   let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
@@ -2356,6 +2359,10 @@ func Test_terminal_in_popup()
   call term_sendkeys(buf, "/edit\<CR>")
   call VerifyScreenDump(buf, 'Test_terminal_popup_3', {})
  
+  call term_sendkeys(buf, "\<C-W>:call HidePopup()\<CR>")
+  call VerifyScreenDump(buf, 'Test_terminal_popup_4', {})
+  call term_sendkeys(buf, "\<CR>")
+
   call term_sendkeys(buf, ":q\<CR>")
   call term_wait(buf, 100)  " wait for terminal to vanish