From 9b10b4cc6463d901b893ad2d522c629d066607d5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 20 Apr 2022 10:26:33 +0800 Subject: vim-patch:8.1.1756: autocommand that splits window messes up window layout Problem: Autocommand that splits window messes up window layout. Solution: Disallow splitting a window while closing one. In ":all" give an error when moving a window will not work. https://github.com/vim/vim/commit/1417c766f55e5959b31da488417b7d9b141404af Expected error number was changed to E242 in Vim in patch 8.2.1183, and patch 8.2.2420 (which has already been ported) made the test no longer throw E249 in Vim, so just use E242 in the test. --- test/functional/autocmd/autocmd_spec.lua | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'test/functional') diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua index 6111654b5e..b8d2c9ec1d 100644 --- a/test/functional/autocmd/autocmd_spec.lua +++ b/test/functional/autocmd/autocmd_spec.lua @@ -548,18 +548,6 @@ describe('autocmd', function() neq({}, meths.get_autocmds { group = "filetypedetect" }) end) - it('should not access freed mem', function() - source [[ - au BufEnter,BufLeave,WinEnter,WinLeave 0 vs xxx - arg 0 - argadd - all - all - au! - bwipe xxx - ]] - end) - it('should allow comma-separated patterns', function() source [[ augroup TestingPatterns -- cgit From e69cb86750d0e4b91d226e827d1eae2a98639777 Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Wed, 23 Mar 2022 15:14:44 -0400 Subject: test: add a Lua functional test for NoName buffer event order --- test/functional/autocmd/autocmd_spec.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/functional') diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua index b8d2c9ec1d..90254b7415 100644 --- a/test/functional/autocmd/autocmd_spec.lua +++ b/test/functional/autocmd/autocmd_spec.lua @@ -60,6 +60,23 @@ describe('autocmd', function() eq(expected, eval('g:evs')) end) + it('first edit causes BufUnload on NoName', function() + local expected = { + {'BufUnload', ''}, + {'BufDelete', ''}, + {'BufWipeout', ''}, + {'BufEnter', 'testfile1'}, + } + command('let g:evs = []') + command('autocmd BufEnter * :call add(g:evs, ["BufEnter", expand("")])') + command('autocmd BufDelete * :call add(g:evs, ["BufDelete", expand("")])') + command('autocmd BufLeave * :call add(g:evs, ["BufLeave", expand("")])') + command('autocmd BufUnload * :call add(g:evs, ["BufUnload", expand("")])') + command('autocmd BufWipeout * :call add(g:evs, ["BufWipeout", expand("")])') + command('edit testfile1') + eq(expected, eval('g:evs')) + end) + it('WinClosed is non-recursive', function() command('let g:triggered = 0') command('autocmd WinClosed * :let g:triggered+=1 | :bdelete 2') -- cgit