comparison src/testdir/test_popupwin.vim @ 20474:3fe45aa3bbc5 v8.2.0791

patch 8.2.0791: a second popup window with terminal causes trouble Commit: https://github.com/vim/vim/commit/b5383b174b2436b556f76f14badb1c1f55d6d8f6 Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 18 19:46:48 2020 +0200 patch 8.2.0791: a second popup window with terminal causes trouble Problem: A second popup window with terminal causes trouble. Solution: Disallow opening a second terminal-popup window. (closes https://github.com/vim/vim/issues/6101, closes #6103) Avoid defaulting to an invalid line number.
author Bram Moolenaar <Bram@vim.org>
date Mon, 18 May 2020 20:00:03 +0200
parents 8216bfb88709
children 18c52f380193
comparison
equal deleted inserted replaced
20473:992024e2f885 20474:3fe45aa3bbc5
2424 CheckUnix 2424 CheckUnix
2425 " Starting a terminal to run a shell in is considered flaky. 2425 " Starting a terminal to run a shell in is considered flaky.
2426 let g:test_is_flaky = 1 2426 let g:test_is_flaky = 1
2427 2427
2428 let origwin = win_getid() 2428 let origwin = win_getid()
2429 let ptybuf = term_start(&shell, #{hidden: 1}) 2429 let termbuf = term_start(&shell, #{hidden: 1})
2430 let winid = popup_create(ptybuf, #{minwidth: 40, minheight: 10}) 2430 let winid = popup_create(termbuf, #{minwidth: 40, minheight: 10})
2431 " Wait for shell to start 2431 " Wait for shell to start
2432 call WaitForAssert({-> assert_equal("run", job_status(term_getjob(ptybuf)))}) 2432 call WaitForAssert({-> assert_equal("run", job_status(term_getjob(termbuf)))})
2433 sleep 100m 2433 sleep 100m
2434 " Check this doesn't crash 2434 " Check this doesn't crash
2435 call assert_equal(winnr(), winnr('j')) 2435 call assert_equal(winnr(), winnr('j'))
2436 call assert_equal(winnr(), winnr('k')) 2436 call assert_equal(winnr(), winnr('k'))
2437 call assert_equal(winnr(), winnr('h')) 2437 call assert_equal(winnr(), winnr('h'))
2438 call assert_equal(winnr(), winnr('l')) 2438 call assert_equal(winnr(), winnr('l'))
2439 2439
2440 " Cannot quit while job is running 2440 " Cannot quit while job is running
2441 call assert_fails('call feedkeys("\<C-W>:quit\<CR>", "xt")', 'E948:') 2441 call assert_fails('call feedkeys("\<C-W>:quit\<CR>", "xt")', 'E948:')
2442 2442
2443 " Cannot enter Terminal-Normal mode. 2443 " Cannot enter Terminal-Normal mode. (TODO: but it works...)
2444 call feedkeys("xxx\<C-W>N", 'xt') 2444 call feedkeys("xxx\<C-W>N", 'xt')
2445 call assert_fails('call feedkeys("gf", "xt")', 'E863:') 2445 call assert_fails('call feedkeys("gf", "xt")', 'E863:')
2446 call feedkeys("a\<C-U>", 'xt') 2446 call feedkeys("a\<C-U>", 'xt')
2447
2448 " Cannot open a second one.
2449 let termbuf2 = term_start(&shell, #{hidden: 1})
2450 call assert_fails('call popup_create(termbuf2, #{})', 'E861:')
2451 call term_sendkeys(termbuf2, "exit\<CR>")
2447 2452
2448 " Exiting shell closes popup window 2453 " Exiting shell closes popup window
2449 call feedkeys("exit\<CR>", 'xt') 2454 call feedkeys("exit\<CR>", 'xt')
2450 " Wait for shell to exit 2455 " Wait for shell to exit
2451 sleep 100m 2456 sleep 100m