mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
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 #10097)
This commit is contained in:
@@ -348,6 +348,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'
|
||||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4700,
|
||||||
/**/
|
/**/
|
||||||
4699,
|
4699,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -2493,7 +2493,7 @@ win_close_buffer(win_T *win, int action, int abort_if_last)
|
|||||||
|
|
||||||
set_bufref(&bufref, curbuf);
|
set_bufref(&bufref, curbuf);
|
||||||
win->w_closing = TRUE;
|
win->w_closing = TRUE;
|
||||||
close_buffer(win, win->w_buffer, action, abort_if_last, FALSE);
|
close_buffer(win, win->w_buffer, action, abort_if_last, TRUE);
|
||||||
if (win_valid_any_tab(win))
|
if (win_valid_any_tab(win))
|
||||||
win->w_closing = FALSE;
|
win->w_closing = FALSE;
|
||||||
// Make sure curbuf is valid. It can become invalid if 'bufhidden' is
|
// Make sure curbuf is valid. It can become invalid if 'bufhidden' is
|
||||||
|
Reference in New Issue
Block a user