mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 00:08:19 +00:00
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:
@@ -5665,7 +5665,7 @@ bool buf_contents_changed(buf_T *buf)
|
|||||||
void
|
void
|
||||||
wipe_buffer(
|
wipe_buffer(
|
||||||
buf_T *buf,
|
buf_T *buf,
|
||||||
int aucmd // When true trigger autocommands.
|
bool aucmd // When true trigger autocommands.
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!aucmd) {
|
if (!aucmd) {
|
||||||
|
@@ -4773,8 +4773,9 @@ void ex_help(exarg_T *eap)
|
|||||||
* window. */
|
* window. */
|
||||||
if (empty_fnum != 0 && curbuf->b_fnum != empty_fnum) {
|
if (empty_fnum != 0 && curbuf->b_fnum != empty_fnum) {
|
||||||
buf = buflist_findnr(empty_fnum);
|
buf = buflist_findnr(empty_fnum);
|
||||||
if (buf != NULL && buf->b_nwindows == 0)
|
if (buf != NULL && buf->b_nwindows == 0) {
|
||||||
wipe_buffer(buf, TRUE);
|
wipe_buffer(buf, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* keep the previous alternate file */
|
/* keep the previous alternate file */
|
||||||
|
@@ -5713,7 +5713,7 @@ static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start)
|
|||||||
// work when got_int is set.
|
// work when got_int is set.
|
||||||
enter_cleanup(&cs);
|
enter_cleanup(&cs);
|
||||||
|
|
||||||
wipe_buffer(buf, FALSE);
|
wipe_buffer(buf, true);
|
||||||
|
|
||||||
// Restore the error/interrupt/exception state if not discarded by a
|
// Restore the error/interrupt/exception state if not discarded by a
|
||||||
// new aborting error, interrupt, or uncaught exception.
|
// new aborting error, interrupt, or uncaught exception.
|
||||||
|
@@ -108,19 +108,19 @@ func Test_bufunload()
|
|||||||
autocmd BufWipeout * call add(s:li, "bufwipeout")
|
autocmd BufWipeout * call add(s:li, "bufwipeout")
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
let s:li=[]
|
let s:li = []
|
||||||
new
|
new
|
||||||
setlocal bufhidden=
|
setlocal bufhidden=
|
||||||
bunload
|
bunload
|
||||||
call assert_equal(["bufunload", "bufdelete"], s:li)
|
call assert_equal(["bufunload", "bufdelete"], s:li)
|
||||||
|
|
||||||
let s:li=[]
|
let s:li = []
|
||||||
new
|
new
|
||||||
setlocal bufhidden=delete
|
setlocal bufhidden=delete
|
||||||
bunload
|
bunload
|
||||||
call assert_equal(["bufunload", "bufdelete"], s:li)
|
call assert_equal(["bufunload", "bufdelete"], s:li)
|
||||||
|
|
||||||
let s:li=[]
|
let s:li = []
|
||||||
new
|
new
|
||||||
setlocal bufhidden=unload
|
setlocal bufhidden=unload
|
||||||
bwipeout
|
bwipeout
|
||||||
@@ -196,6 +196,29 @@ func Test_autocmd_bufunload_avoiding_SEGV_02()
|
|||||||
bwipe! a.txt
|
bwipe! a.txt
|
||||||
endfunc
|
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()
|
func Test_win_tab_autocmd()
|
||||||
let g:record = []
|
let g:record = []
|
||||||
|
|
||||||
@@ -428,7 +451,7 @@ func Test_autocmd_bufwipe_in_SessLoadPost()
|
|||||||
|
|
||||||
let content =<< trim [CODE]
|
let content =<< trim [CODE]
|
||||||
set nocp noswapfile
|
set nocp noswapfile
|
||||||
let v:swapchoice="e"
|
let v:swapchoice = "e"
|
||||||
augroup test_autocmd_sessionload
|
augroup test_autocmd_sessionload
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!"
|
autocmd SessionLoadPost * exe bufnr("Xsomething") . "bw!"
|
||||||
@@ -537,92 +560,92 @@ func Test_OptionSet()
|
|||||||
au OptionSet * :call s:AutoCommandOptionSet(expand("<amatch>"))
|
au OptionSet * :call s:AutoCommandOptionSet(expand("<amatch>"))
|
||||||
|
|
||||||
" 1: Setting number option"
|
" 1: Setting number option"
|
||||||
let g:options=[['number', 0, 1, 'global']]
|
let g:options = [['number', 0, 1, 'global']]
|
||||||
set nu
|
set nu
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 2: Setting local number option"
|
" 2: Setting local number option"
|
||||||
let g:options=[['number', 1, 0, 'local']]
|
let g:options = [['number', 1, 0, 'local']]
|
||||||
setlocal nonu
|
setlocal nonu
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 3: Setting global number option"
|
" 3: Setting global number option"
|
||||||
let g:options=[['number', 1, 0, 'global']]
|
let g:options = [['number', 1, 0, 'global']]
|
||||||
setglobal nonu
|
setglobal nonu
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 4: Setting local autoindent option"
|
" 4: Setting local autoindent option"
|
||||||
let g:options=[['autoindent', 0, 1, 'local']]
|
let g:options = [['autoindent', 0, 1, 'local']]
|
||||||
setlocal ai
|
setlocal ai
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 5: Setting global autoindent option"
|
" 5: Setting global autoindent option"
|
||||||
let g:options=[['autoindent', 0, 1, 'global']]
|
let g:options = [['autoindent', 0, 1, 'global']]
|
||||||
setglobal ai
|
setglobal ai
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 6: Setting global autoindent option"
|
" 6: Setting global autoindent option"
|
||||||
let g:options=[['autoindent', 1, 0, 'global']]
|
let g:options = [['autoindent', 1, 0, 'global']]
|
||||||
set ai!
|
set ai!
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" Should not print anything, use :noa
|
" Should not print anything, use :noa
|
||||||
" 7: don't trigger OptionSet"
|
" 7: don't trigger OptionSet"
|
||||||
let g:options=[['invalid', 1, 1, 'invalid']]
|
let g:options = [['invalid', 1, 1, 'invalid']]
|
||||||
noa set nonu
|
noa set nonu
|
||||||
call assert_equal([['invalid', 1, 1, 'invalid']], g:options)
|
call assert_equal([['invalid', 1, 1, 'invalid']], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 8: Setting several global list and number option"
|
" 8: Setting several global list and number option"
|
||||||
let g:options=[['list', 0, 1, 'global'], ['number', 0, 1, 'global']]
|
let g:options = [['list', 0, 1, 'global'], ['number', 0, 1, 'global']]
|
||||||
set list nu
|
set list nu
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 9: don't trigger OptionSet"
|
" 9: don't trigger OptionSet"
|
||||||
let g:options=[['invalid', 1, 1, 'invalid'], ['invalid', 1, 1, 'invalid']]
|
let g:options = [['invalid', 1, 1, 'invalid'], ['invalid', 1, 1, 'invalid']]
|
||||||
noa set nolist nonu
|
noa set nolist nonu
|
||||||
call assert_equal([['invalid', 1, 1, 'invalid'], ['invalid', 1, 1, 'invalid']], g:options)
|
call assert_equal([['invalid', 1, 1, 'invalid'], ['invalid', 1, 1, 'invalid']], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 10: Setting global acd"
|
" 10: Setting global acd"
|
||||||
let g:options=[['autochdir', 0, 1, 'local']]
|
let g:options = [['autochdir', 0, 1, 'local']]
|
||||||
setlocal acd
|
setlocal acd
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 11: Setting global autoread (also sets local value)"
|
" 11: Setting global autoread (also sets local value)"
|
||||||
let g:options=[['autoread', 0, 1, 'global']]
|
let g:options = [['autoread', 0, 1, 'global']]
|
||||||
set ar
|
set ar
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 12: Setting local autoread"
|
" 12: Setting local autoread"
|
||||||
let g:options=[['autoread', 1, 1, 'local']]
|
let g:options = [['autoread', 1, 1, 'local']]
|
||||||
setlocal ar
|
setlocal ar
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 13: Setting global autoread"
|
" 13: Setting global autoread"
|
||||||
let g:options=[['autoread', 1, 0, 'global']]
|
let g:options = [['autoread', 1, 0, 'global']]
|
||||||
setglobal invar
|
setglobal invar
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 14: Setting option backspace through :let"
|
" 14: Setting option backspace through :let"
|
||||||
let g:options=[['backspace', '', 'eol,indent,start', 'global']]
|
let g:options = [['backspace', '', 'eol,indent,start', 'global']]
|
||||||
let &bs="eol,indent,start"
|
let &bs = "eol,indent,start"
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 15: Setting option backspace through setbufvar()"
|
" 15: Setting option backspace through setbufvar()"
|
||||||
let g:options=[['backup', 0, 1, 'local']]
|
let g:options = [['backup', 0, 1, 'local']]
|
||||||
" try twice, first time, shouldn't trigger because option name is invalid,
|
" try twice, first time, shouldn't trigger because option name is invalid,
|
||||||
" second time, it should trigger
|
" second time, it should trigger
|
||||||
call assert_fails("call setbufvar(1, '&l:bk', 1)", "E355")
|
call assert_fails("call setbufvar(1, '&l:bk', 1)", "E355")
|
||||||
@@ -632,13 +655,13 @@ func Test_OptionSet()
|
|||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 16: Setting number option using setwinvar"
|
" 16: Setting number option using setwinvar"
|
||||||
let g:options=[['number', 0, 1, 'local']]
|
let g:options = [['number', 0, 1, 'local']]
|
||||||
call setwinvar(0, '&number', 1)
|
call setwinvar(0, '&number', 1)
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 17: Setting key option, shouldn't trigger"
|
" 17: Setting key option, shouldn't trigger"
|
||||||
let g:options=[['key', 'invalid', 'invalid1', 'invalid']]
|
let g:options = [['key', 'invalid', 'invalid1', 'invalid']]
|
||||||
setlocal key=blah
|
setlocal key=blah
|
||||||
setlocal key=
|
setlocal key=
|
||||||
call assert_equal([['key', 'invalid', 'invalid1', 'invalid']], g:options)
|
call assert_equal([['key', 'invalid', 'invalid1', 'invalid']], g:options)
|
||||||
@@ -646,13 +669,13 @@ func Test_OptionSet()
|
|||||||
|
|
||||||
" 18: Setting string option"
|
" 18: Setting string option"
|
||||||
let oldval = &tags
|
let oldval = &tags
|
||||||
let g:options=[['tags', oldval, 'tagpath', 'global']]
|
let g:options = [['tags', oldval, 'tagpath', 'global']]
|
||||||
set tags=tagpath
|
set tags=tagpath
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
|
|
||||||
" 1l: Resetting string option"
|
" 1l: Resetting string option"
|
||||||
let g:options=[['tags', 'tagpath', oldval, 'global']]
|
let g:options = [['tags', 'tagpath', oldval, 'global']]
|
||||||
set tags&
|
set tags&
|
||||||
call assert_equal([], g:options)
|
call assert_equal([], g:options)
|
||||||
call assert_equal(g:opt[0], g:opt[1])
|
call assert_equal(g:opt[0], g:opt[1])
|
||||||
@@ -672,7 +695,7 @@ func Test_OptionSet_diffmode()
|
|||||||
call test_override('starting', 1)
|
call test_override('starting', 1)
|
||||||
" 18: Changing an option when entering diff mode
|
" 18: Changing an option when entering diff mode
|
||||||
new
|
new
|
||||||
au OptionSet diff :let &l:cul=v:option_new
|
au OptionSet diff :let &l:cul = v:option_new
|
||||||
|
|
||||||
call setline(1, ['buffer 1', 'line2', 'line3', 'line4'])
|
call setline(1, ['buffer 1', 'line2', 'line3', 'line4'])
|
||||||
call assert_equal(0, &l:cul)
|
call assert_equal(0, &l:cul)
|
||||||
@@ -1754,7 +1777,7 @@ func Test_autocmd_CmdWinEnter()
|
|||||||
autocmd CmdWinEnter * quit
|
autocmd CmdWinEnter * quit
|
||||||
let winnr = winnr('$')
|
let winnr = winnr('$')
|
||||||
END
|
END
|
||||||
let filename='XCmdWinEnter'
|
let filename = 'XCmdWinEnter'
|
||||||
call writefile(lines, filename)
|
call writefile(lines, filename)
|
||||||
let buf = RunVimInTerminal('-S '.filename, #{rows: 6})
|
let buf = RunVimInTerminal('-S '.filename, #{rows: 6})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user