aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-24 22:25:23 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-24 22:29:41 -0500
commiteae90b37c37410f2f28c66c8b4535e5a5ce65cc8 (patch)
tree0ca46d4bbb78d0ccc43739a8fc3c1ea81c8a72dd
parent3a573a9e2fccf623e17a5c0482e8bc02545d4606 (diff)
downloadrneovim-eae90b37c37410f2f28c66c8b4535e5a5ce65cc8.tar.gz
rneovim-eae90b37c37410f2f28c66c8b4535e5a5ce65cc8.tar.bz2
rneovim-eae90b37c37410f2f28c66c8b4535e5a5ce65cc8.zip
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) https://github.com/vim/vim/commit/0c81d1b11278b2d962aa6fbb4aa974dab97be59d
-rw-r--r--src/nvim/testdir/test_autocmd.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
index 01ff8c7129..f1c1d45ada 100644
--- a/src/nvim/testdir/test_autocmd.vim
+++ b/src/nvim/testdir/test_autocmd.vim
@@ -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()