mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 01:46:29 +00:00
vim-patch:8.2.4700: buffer remains active if WinClosed event throws an exception
Problem: Buffer remains active if a WinClosed event throws an exception.
Solution: Ignore aborting() when closing the buffer. (closes vim/vim#10097)
c947b9ae41
This commit is contained in:
@@ -299,6 +299,23 @@ func Test_WinClosed()
|
|||||||
unlet g:triggered
|
unlet g:triggered
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_WinClosed_throws()
|
||||||
|
vnew
|
||||||
|
let bnr = bufnr()
|
||||||
|
call assert_equal(1, bufloaded(bnr))
|
||||||
|
augroup test-WinClosed
|
||||||
|
autocmd WinClosed * throw 'foo'
|
||||||
|
augroup END
|
||||||
|
try
|
||||||
|
close
|
||||||
|
catch /.*/
|
||||||
|
endtry
|
||||||
|
call assert_equal(0, bufloaded(bnr))
|
||||||
|
|
||||||
|
autocmd! test-WinClosed
|
||||||
|
augroup! test-WinClosed
|
||||||
|
endfunc
|
||||||
|
|
||||||
func s:AddAnAutocmd()
|
func s:AddAnAutocmd()
|
||||||
augroup vimBarTest
|
augroup vimBarTest
|
||||||
au BufReadCmd * echo 'hello'
|
au BufReadCmd * echo 'hello'
|
||||||
|
@@ -2563,7 +2563,7 @@ static void win_close_buffer(win_T *win, bool free_buf, bool abort_if_last)
|
|||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
set_bufref(&bufref, curbuf);
|
set_bufref(&bufref, curbuf);
|
||||||
win->w_closing = true;
|
win->w_closing = true;
|
||||||
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, abort_if_last, false);
|
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, abort_if_last, true);
|
||||||
if (win_valid_any_tab(win)) {
|
if (win_valid_any_tab(win)) {
|
||||||
win->w_closing = false;
|
win->w_closing = false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user