diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua index 5fffb70095..8fa0ccec5a 100644 --- a/test/functional/autocmd/autocmd_spec.lua +++ b/test/functional/autocmd/autocmd_spec.lua @@ -371,6 +371,31 @@ describe('autocmd', function() assert_alive() screen:expect_unchanged() + -- Also check with win_splitmove(). + exec_lua [[ + vim.api.nvim_buf_call(_G.buf, function() + vim.fn.win_splitmove(vim.fn.winnr(), vim.fn.win_getid(1)) + end) + ]] + screen:expect_unchanged() + + -- Also check with nvim_win_set_config(). + matches( + ': Failed to move window %d+ into split$', + pcall_err( + exec_lua, + [[ + vim.api.nvim_buf_call(_G.buf, function() + vim.api.nvim_win_set_config(0, { + vertical = true, + win = vim.fn.win_getid(1) + }) + end) + ]] + ) + ) + screen:expect_unchanged() + -- Ensure splitting still works from inside the aucmd_win. exec_lua [[vim.api.nvim_buf_call(_G.buf, function() vim.cmd "split" end)]] screen:expect [[ @@ -391,12 +416,12 @@ describe('autocmd', function() eq( 'editor', exec_lua [[ - vim.cmd "only" - vim.api.nvim_buf_call(_G.buf, function() - _G.config = vim.api.nvim_win_get_config(0) - end) - return _G.config.relative - ]] + vim.cmd "only" + vim.api.nvim_buf_call(_G.buf, function() + _G.config = vim.api.nvim_win_get_config(0) + end) + return _G.config.relative + ]] ) end) @@ -437,11 +462,11 @@ describe('autocmd', function() pcall_err( exec_lua, [[ - vim.api.nvim_buf_call(_G.buf, function() - local win = vim.api.nvim_get_current_win() - vim.api.nvim_win_close(win, true) - end) - ]] + vim.api.nvim_buf_call(_G.buf, function() + local win = vim.api.nvim_get_current_win() + vim.api.nvim_win_close(win, true) + end) + ]] ) ) matches( @@ -449,12 +474,12 @@ describe('autocmd', function() pcall_err( exec_lua, [[ - vim.api.nvim_buf_call(_G.buf, function() - local win = vim.api.nvim_get_current_win() - vim.cmd('tabnext') - vim.api.nvim_win_close(win, true) - end) - ]] + vim.api.nvim_buf_call(_G.buf, function() + local win = vim.api.nvim_get_current_win() + vim.cmd('tabnext') + vim.api.nvim_win_close(win, true) + end) + ]] ) ) matches( @@ -462,11 +487,11 @@ describe('autocmd', function() pcall_err( exec_lua, [[ - vim.api.nvim_buf_call(_G.buf, function() - local win = vim.api.nvim_get_current_win() - vim.api.nvim_win_hide(win) - end) - ]] + vim.api.nvim_buf_call(_G.buf, function() + local win = vim.api.nvim_get_current_win() + vim.api.nvim_win_hide(win) + end) + ]] ) ) matches( @@ -474,12 +499,12 @@ describe('autocmd', function() pcall_err( exec_lua, [[ - vim.api.nvim_buf_call(_G.buf, function() - local win = vim.api.nvim_get_current_win() - vim.cmd('tabnext') - vim.api.nvim_win_hide(win) - end) - ]] + vim.api.nvim_buf_call(_G.buf, function() + local win = vim.api.nvim_get_current_win() + vim.cmd('tabnext') + vim.api.nvim_win_hide(win) + end) + ]] ) ) end)