vim-patch:8.2.2185: BufUnload is not triggered for the quickfix dummy buffer

Problem:    BufUnload is not triggered for the quickfix dummy buffer.
Solution:   Do trigger BufUnload. (Pontus Leitzler,closes vim/vim#7518, closes vim/vim#7517)
            Fix white space around "=".
1cfb9bb5c0
This commit is contained in:
Jan Edmund Lazo
2021-06-23 22:46:02 -04:00
parent 4cb0bf0942
commit cd4b649136
4 changed files with 54 additions and 30 deletions

View File

@@ -5665,7 +5665,7 @@ bool buf_contents_changed(buf_T *buf)
void
wipe_buffer(
buf_T *buf,
int aucmd // When true trigger autocommands.
bool aucmd // When true trigger autocommands.
)
{
if (!aucmd) {

View File

@@ -4773,8 +4773,9 @@ void ex_help(exarg_T *eap)
* window. */
if (empty_fnum != 0 && curbuf->b_fnum != empty_fnum) {
buf = buflist_findnr(empty_fnum);
if (buf != NULL && buf->b_nwindows == 0)
wipe_buffer(buf, TRUE);
if (buf != NULL && buf->b_nwindows == 0) {
wipe_buffer(buf, true);
}
}
/* keep the previous alternate file */

View File

@@ -5713,7 +5713,7 @@ static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start)
// work when got_int is set.
enter_cleanup(&cs);
wipe_buffer(buf, FALSE);
wipe_buffer(buf, true);
// Restore the error/interrupt/exception state if not discarded by a
// new aborting error, interrupt, or uncaught exception.

View File

@@ -196,6 +196,29 @@ func Test_autocmd_bufunload_avoiding_SEGV_02()
bwipe! a.txt
endfunc
func Test_autocmd_dummy_wipeout()
" prepare files
call writefile([''], 'Xdummywipetest1.txt')
call writefile([''], 'Xdummywipetest2.txt')
augroup test_bufunload_group
autocmd!
autocmd BufUnload * call add(s:li, "bufunload")
autocmd BufDelete * call add(s:li, "bufdelete")
autocmd BufWipeout * call add(s:li, "bufwipeout")
augroup END
let s:li = []
split Xdummywipetest1.txt
silent! vimgrep /notmatched/ Xdummywipetest*
call assert_equal(["bufunload", "bufwipeout"], s:li)
bwipeout
call delete('Xdummywipetest1.txt')
call delete('Xdummywipetest2.txt')
au! test_bufunload_group
augroup! test_bufunload_group
endfunc
func Test_win_tab_autocmd()
let g:record = []