diff src/testdir/test_terminal.vim @ 19647:c8cb1a41f64c v8.2.0380

patch 8.2.0380: tiny popup when creating a terminal popup without minwidth Commit: https://github.com/vim/vim/commit/193982650960f8411df51f3b3b0d44a75e1ac034 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 14 15:28:08 2020 +0100 patch 8.2.0380: tiny popup when creating a terminal popup without minwidth Problem: Tiny popup when creating a terminal popup without minwidth. Solution: Use a default mininum size of 5 lines of 20 characters.
author Bram Moolenaar <Bram@vim.org>
date Sat, 14 Mar 2020 15:30:03 +0100
parents 4cce471fa537
children 283c8bc6a8e2
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -2400,6 +2400,43 @@ func Test_terminal_in_popup()
   call term_wait(buf, 100)  " wait for terminal to vanish
 
   call StopVimInTerminal(buf)
+  call delete('Xtext')
+  call delete('XtermPopup')
+endfunc
+
+" Check a terminal in popup window uses the default mininum size.
+func Test_terminal_in_popup_min_size()
+  CheckRunVimInTerminal
+
+  let text =<< trim END
+    another text
+    to show
+    in a popup window
+  END
+  call writefile(text, 'Xtext')
+  let lines = [
+	\ 'set t_u7=',
+	\ 'call setline(1, range(20))',
+	\ 'hi PopTerm ctermbg=grey',
+	\ 'func OpenTerm()',
+	\ "  let s:buf = term_start('cat Xtext', #{hidden: 1})",
+	\ '  let g:winid = popup_create(s:buf, #{ border: []})',
+	\ 'endfunc',
+	\ ]
+  call writefile(lines, 'XtermPopup')
+  let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
+  call term_wait(buf, 100)
+  call term_sendkeys(buf, "\<C-L>")
+  call term_sendkeys(buf, ":call OpenTerm()\<CR>")
+  call term_wait(buf, 100)
+  call term_sendkeys(buf, ":\<CR>")
+  call VerifyScreenDump(buf, 'Test_terminal_popup_m1', {})
+
+  call term_wait(buf, 100)
+  call term_sendkeys(buf, ":q\<CR>")
+  call term_wait(buf, 100)  " wait for terminal to vanish
+  call StopVimInTerminal(buf)
+  call delete('Xtext')
   call delete('XtermPopup')
 endfunc