1
0
forked from aniani/vim

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'.
This commit is contained in:
Bram Moolenaar
2017-09-21 22:16:21 +02:00
parent 9cb03716c9
commit b00fdf6eed
2 changed files with 6 additions and 0 deletions

View File

@@ -34,7 +34,9 @@ func Stop_shell_in_terminal(buf)
endfunc endfunc
func Test_terminal_basic() func Test_terminal_basic()
au BufWinEnter * if &buftype == 'terminal' | let b:done = 'yes' | endif
let buf = Run_shell_in_terminal({}) let buf = Run_shell_in_terminal({})
if has("unix") if has("unix")
call assert_match('^/dev/', job_info(g:job).tty_out) call assert_match('^/dev/', job_info(g:job).tty_out)
call assert_match('^/dev/', term_gettty('')) call assert_match('^/dev/', term_gettty(''))
@@ -43,6 +45,7 @@ func Test_terminal_basic()
call assert_match('^\\\\.\\pipe\\', term_gettty('')) call assert_match('^\\\\.\\pipe\\', term_gettty(''))
endif endif
call assert_equal('t', mode()) call assert_equal('t', mode())
call assert_equal('yes', b:done)
call assert_match('%aR[^\n]*running]', execute('ls')) call assert_match('%aR[^\n]*running]', execute('ls'))
call Stop_shell_in_terminal(buf) call Stop_shell_in_terminal(buf)
@@ -54,6 +57,7 @@ func Test_terminal_basic()
close close
call assert_equal("", bufname(buf)) call assert_equal("", bufname(buf))
au! BufWinEnter
unlet g:job unlet g:job
endfunc endfunc

View File

@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1131,
/**/ /**/
1130, 1130,
/**/ /**/