diff src/testdir/test_terminal.vim @ 13444:9f06f7aca74c v8.0.1596

patch 8.0.1596: no autocommand specifically for opening a terminal window commit https://github.com/vim/vim/commit/b852c3e64d319d6ec47dd780c8654ae095e1d8c2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 11 16:55:36 2018 +0100 patch 8.0.1596: no autocommand specifically for opening a terminal window Problem: No autocommand specifically for opening a terminal window. Solution: Add TerminalOpen. (?, closes https://github.com/vim/vim/issues/2484)
author Christian Brabandt <cb@256bit.org>
date Sun, 11 Mar 2018 17:00:08 +0100
parents 22439cdda382
children 568dcfac9daf
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -908,3 +908,37 @@ func Test_terminal_qall_prompt()
   " close the terminal window where Vim was running
   quit
 endfunc
+
+func Test_terminalopen_autocmd()
+  augroup repro
+    au!
+    au TerminalOpen * let s:called += 1
+  augroup END
+
+  let s:called = 0
+
+  " Open a terminal window with :terminal
+  terminal
+  call assert_equal(1, s:called)
+  bwipe!
+
+  " Open a terminal window with term_start()
+  call term_start(&shell)
+  call assert_equal(2, s:called)
+  bwipe!
+
+  " Open a hidden terminal buffer with :terminal
+  terminal ++hidden
+  call assert_equal(3, s:called)
+  for buf in term_list()
+    exe buf . "bwipe!"
+  endfor
+
+  " Open a hidden terminal buffer with term_start()
+  let buf = term_start(&shell, {'hidden': 1})
+  call assert_equal(4, s:called)
+  exe buf . "bwipe!"
+
+  unlet s:called
+  au! repro
+endfunction