comparison src/testdir/test_terminal.vim @ 12031:9897241c08b5 v8.0.0896

patch 8.0.0896: cannot close a terminal window when the job ends commit https://github.com/vim/vim/commit/dd693ce28b158ff573129ee30fe5b886544a03c2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 10 23:15:19 2017 +0200 patch 8.0.0896: cannot close a terminal window when the job ends Problem: Cannot automaticlaly close a terminal window when the job ends. Solution: Add the ++close argument to :term. Add the term_finish option to term_start(). (Yasuhiro Matsumoto, closes #1950) Also add ++open.
author Christian Brabandt <cb@256bit.org>
date Thu, 10 Aug 2017 23:30:05 +0200
parents c0ee48f48a2b
children 2796a2c9fc17
comparison
equal deleted inserted replaced
12030:4d0860530243 12031:9897241c08b5
262 exe 'vertical 6,20terminal ' . cmd 262 exe 'vertical 6,20terminal ' . cmd
263 let size = term_getsize('') 263 let size = term_getsize('')
264 bwipe! 264 bwipe!
265 call assert_equal([6, 20], size) 265 call assert_equal([6, 20], size)
266 endfunc 266 endfunc
267
268 func Test_finish_close()
269 call assert_equal(1, winnr('$'))
270
271 " TODO: use something that takes much less than a whole second
272 if has('win32')
273 let cmd = $windir . '\system32\timeout.exe 1'
274 else
275 let cmd = 'sleep 1'
276 endif
277 exe 'terminal ++close ' . cmd
278 let buf = bufnr('')
279 call assert_equal(2, winnr('$'))
280
281 wincmd p
282 sleep 1200 msec
283 call assert_equal(1, winnr('$'))
284
285 call term_start(cmd, {'term_finish': 'close'})
286 call assert_equal(2, winnr('$'))
287 let buf = bufnr('')
288 wincmd p
289 sleep 1200 msec
290 call assert_equal(1, winnr('$'))
291
292 exe 'terminal ++open ' . cmd
293 let buf = bufnr('')
294 close
295 sleep 1200 msec
296 call assert_equal(2, winnr('$'))
297 bwipe
298
299 call term_start(cmd, {'term_finish': 'open'})
300 let buf = bufnr('')
301 close
302 sleep 1200 msec
303 call assert_equal(2, winnr('$'))
304
305 bwipe
306 endfunc