Skip to content

Commit b00fdf6

Browse files
committed
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'.
1 parent 9cb0371 commit b00fdf6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/testdir/test_terminal.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ func Stop_shell_in_terminal(buf)
3434
endfunc
3535

3636
func Test_terminal_basic()
37+
au BufWinEnter * if &buftype == 'terminal' | let b:done = 'yes' | endif
3738
let buf = Run_shell_in_terminal({})
39+
3840
if has("unix")
3941
call assert_match('^/dev/', job_info(g:job).tty_out)
4042
call assert_match('^/dev/', term_gettty(''))
@@ -43,6 +45,7 @@ func Test_terminal_basic()
4345
call assert_match('^\\\\.\\pipe\\', term_gettty(''))
4446
endif
4547
call assert_equal('t', mode())
48+
call assert_equal('yes', b:done)
4649
call assert_match('%aR[^\n]*running]', execute('ls'))
4750

4851
call Stop_shell_in_terminal(buf)
@@ -54,6 +57,7 @@ func Test_terminal_basic()
5457
close
5558
call assert_equal("", bufname(buf))
5659

60+
au! BufWinEnter
5761
unlet g:job
5862
endfunc
5963

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1131,
764766
/**/
765767
1130,
766768
/**/

0 commit comments

Comments
 (0)