diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2022-07-05 11:31:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 02:31:49 -0700 |
commit | d0835617facc98daf79318e26d41669bb2ce1a6b (patch) | |
tree | be959e03888b70a0c8410280d2dcd65a97c367db /test/functional | |
parent | eb814bdca0bad2a68e111d59fae62f79b8dbeef1 (diff) | |
download | rneovim-d0835617facc98daf79318e26d41669bb2ce1a6b.tar.gz rneovim-d0835617facc98daf79318e26d41669bb2ce1a6b.tar.bz2 rneovim-d0835617facc98daf79318e26d41669bb2ce1a6b.zip |
fix(terminal): crash if TermClose deletes own buffer #19222
- Partially fixes #10386 except for the case where the alternate buffer
is the default, empty, first buffer created on startup. #vimlife
- TODO: port patches related to `can_unload_buffer`, maybe that fully
fixes #10386?
vim-patch:8.0.1732: crash when terminal API call deletes the buffer
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/autocmd/termxx_spec.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/functional/autocmd/termxx_spec.lua b/test/functional/autocmd/termxx_spec.lua index c418a12faf..859c2ebf44 100644 --- a/test/functional/autocmd/termxx_spec.lua +++ b/test/functional/autocmd/termxx_spec.lua @@ -7,6 +7,8 @@ local eval, eq, neq, retry = helpers.eval, helpers.eq, helpers.neq, helpers.retry local ok = helpers.ok local feed = helpers.feed +local pcall_err = helpers.pcall_err +local assert_alive = helpers.assert_alive local iswin = helpers.iswin describe('autocmd TermClose', function() @@ -16,6 +18,24 @@ describe('autocmd TermClose', function() command('set shellcmdflag=EXE shellredir= shellpipe= shellquote= shellxquote=') end) + + local function test_termclose_delete_own_buf() + command('autocmd TermClose * bdelete!') + command('terminal') + eq('Vim(bdelete):E937: Attempt to delete a buffer that is in use', pcall_err(command, 'bdelete!')) + assert_alive() + end + + -- TODO: fixed after merging patches for `can_unload_buffer`? + pending('TermClose deleting its own buffer, altbuf = buffer 1 #10386', function() + test_termclose_delete_own_buf() + end) + + it('TermClose deleting its own buffer, altbuf NOT buffer 1 #10386', function() + command('edit foo1') + test_termclose_delete_own_buf() + end) + it('triggers when fast-exiting terminal job stops', function() command('autocmd TermClose * let g:test_termclose = 23') command('terminal') |