diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-10-19 12:37:42 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-10-19 12:37:42 +0200 |
commit | 87ffb5c1a3aa506a1be07af4e794b3753f839dc3 (patch) | |
tree | 397eab50b1669ae9111a6f6fcdac4201abbb9503 /src/testdir/test_autocmd.vim | |
parent | 6daeef1933be68055aabe1d55f8467d46a707753 (diff) |
patch 8.0.1204: a QuitPre autocommand may get the wrong file namev8.0.1204
Problem: A QuitPre autocommand may get the wrong file name.
Solution: Pass the buffer being closed to apply_autocmds(). (Rich Howe)
Diffstat (limited to 'src/testdir/test_autocmd.vim')
-rw-r--r-- | src/testdir/test_autocmd.vim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 593d1cc409..f5a228995a 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -779,3 +779,17 @@ func Test_BufLeave_Wipe() " check that bufinfo doesn't contain a pointer to freed memory call test_garbagecollect_now() endfunc + +func Test_QuitPre() + edit Xfoo + let winid = win_getid(winnr()) + split Xbar + au! QuitPre * let g:afile = expand('<afile>') + " Close the other window, <afile> should be correct. + exe win_id2win(winid) . 'q' + call assert_equal('Xfoo', g:afile) + + unlet g:afile + bwipe Xfoo + bwipe Xbar +endfunc |