mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
vim-patch:8.2.4706: buffer remains active with WinClosed and tabpages
Problem: Buffer remains active if a WinClosed event throws an exception
when there are multiple tabpages.
Solution: Ignore aborting() when closing the buffer. (closes vim/vim#10101)
6a06940f8a
This commit is contained in:
parent
b7bc931f63
commit
191f009ab7
@ -316,6 +316,23 @@ func Test_WinClosed_throws()
|
||||
augroup! test-WinClosed
|
||||
endfunc
|
||||
|
||||
func Test_WinClosed_throws_with_tabs()
|
||||
tabnew
|
||||
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()
|
||||
augroup vimBarTest
|
||||
au BufReadCmd * echo 'hello'
|
||||
|
@ -2885,7 +2885,7 @@ void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp)
|
||||
|
||||
if (win->w_buffer != NULL) {
|
||||
// Close the link to the buffer.
|
||||
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, false, false);
|
||||
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, false, true);
|
||||
}
|
||||
|
||||
// Careful: Autocommands may have closed the tab page or made it the
|
||||
|
Loading…
Reference in New Issue
Block a user