changeset 12505:5cf248ecb6e3 v8.0.1131

patch 8.0.1131: not easy to trigger an autocommand for new terminal window commit https://github.com/vim/vim/commit/b00fdf6eed5fec589a86655249a851c2d9ba3bb8 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 21 22:16:21 2017 +0200 patch 8.0.1131: not easy to trigger an autocommand for new terminal window Problem: It is not easy to trigger an autocommand for new terminal window. (Marco Restelli) Solution: Trigger BufWinEnter after setting 'buftype'.
author Christian Brabandt <cb@256bit.org>
date Thu, 21 Sep 2017 22:30:04 +0200
parents 418626139d67
children d4698612d334
files src/testdir/test_terminal.vim src/version.c
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -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
 
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1131,
+/**/
     1130,
 /**/
     1129,