vim-patch:8.2.0302: setting 'term' may cause error in TermChanged autocommand

Problem:    Setting 'term' may cause error in TermChanged autocommand.
Solution:   Use aucmd_prepbuf() to switch to the buffer where the autocommand
            is to be executed. (closes vim/vim#5682)
0c81d1b112
This commit is contained in:
Jan Edmund Lazo 2020-11-24 22:25:23 -05:00
parent 3a573a9e2f
commit eae90b37c3
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15

View File

@ -1857,6 +1857,26 @@ func Test_FileChangedShell_reload()
call delete('Xchanged')
endfunc
func LogACmd()
call add(g:logged, line('$'))
endfunc
func Test_TermChanged()
enew!
tabnew
call setline(1, ['a', 'b', 'c', 'd'])
$
au TermChanged * call LogACmd()
let g:logged = []
let term_save = &term
set term=xterm
call assert_equal([1, 4], g:logged)
au! TermChanged
let &term = term_save
bwipe!
endfunc
" Test for FileReadCmd autocmd
func Test_autocmd_FileReadCmd()
func ReadFileCmd()