]> granicus.if.org Git - vim/commitdiff
patch 8.0.1131: not easy to trigger an autocommand for new terminal window v8.0.1131
authorBram Moolenaar <Bram@vim.org>
Thu, 21 Sep 2017 20:16:21 +0000 (22:16 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 21 Sep 2017 20:16:21 +0000 (22:16 +0200)
Problem:    It is not easy to trigger an autocommand for new terminal window.
            (Marco Restelli)
Solution:   Trigger BufWinEnter after setting 'buftype'.

src/testdir/test_terminal.vim
src/version.c

index 17167e89ffb033a9bda178d2a3d305560b78a0c9..cff85a459382db7be9555c5b51df1791fc904988 100644 (file)
@@ -34,7 +34,9 @@ func Stop_shell_in_terminal(buf)
 endfunc
 
 func Test_terminal_basic()
+  au BufWinEnter * if &buftype == 'terminal' | let b:done = 'yes' | endif
   let buf = Run_shell_in_terminal({})
+
   if has("unix")
     call assert_match('^/dev/', job_info(g:job).tty_out)
     call assert_match('^/dev/', term_gettty(''))
@@ -43,6 +45,7 @@ func Test_terminal_basic()
     call assert_match('^\\\\.\\pipe\\', term_gettty(''))
   endif
   call assert_equal('t', mode())
+  call assert_equal('yes', b:done)
   call assert_match('%aR[^\n]*running]', execute('ls'))
 
   call Stop_shell_in_terminal(buf)
@@ -54,6 +57,7 @@ func Test_terminal_basic()
   close
   call assert_equal("", bufname(buf))
 
+  au! BufWinEnter
   unlet g:job
 endfunc
 
index 84dd7e7a8a20667267645d414386a3010cfa7d28..1ff5b3ef4b307b1e8887d4657b4d708bb9d33ee6 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1131,
 /**/
     1130,
 /**/