Mercurial > vim
comparison src/testdir/test_autocmd.vim @ 12652:272ecbaf1b4f v8.0.1204
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
commit https://github.com/vim/vim/commit/87ffb5c1a3aa506a1be07af4e794b3753f839dc3
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 19 12:37:42 2017 +0200
patch 8.0.1204: a QuitPre autocommand may get the wrong file name
Problem: A QuitPre autocommand may get the wrong file name.
Solution: Pass the buffer being closed to apply_autocmds(). (Rich Howe)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 19 Oct 2017 12:45:07 +0200 |
parents | 1fad9675d8fd |
children | 0a9dacb8826a |
comparison
equal
deleted
inserted
replaced
12651:456433325479 | 12652:272ecbaf1b4f |
---|---|
777 au! BufLeave | 777 au! BufLeave |
778 | 778 |
779 " check that bufinfo doesn't contain a pointer to freed memory | 779 " check that bufinfo doesn't contain a pointer to freed memory |
780 call test_garbagecollect_now() | 780 call test_garbagecollect_now() |
781 endfunc | 781 endfunc |
782 | |
783 func Test_QuitPre() | |
784 edit Xfoo | |
785 let winid = win_getid(winnr()) | |
786 split Xbar | |
787 au! QuitPre * let g:afile = expand('<afile>') | |
788 " Close the other window, <afile> should be correct. | |
789 exe win_id2win(winid) . 'q' | |
790 call assert_equal('Xfoo', g:afile) | |
791 | |
792 unlet g:afile | |
793 bwipe Xfoo | |
794 bwipe Xbar | |
795 endfunc |