refactor: unify context-switching concepts

This commit is contained in:
Justin M. Keyes
2026-07-09 19:50:16 +02:00
parent 982d2f2531
commit 6bb1aa74e6
25 changed files with 691 additions and 633 deletions

View File

@@ -2553,6 +2553,16 @@ describe('api/buf', function()
end)
describe('nvim_buf_call', function()
it('preserves visual-mode, unless the callback ended it', function()
-- Same-buffer: Visual survives untouched.
command('normal! v')
exec_lua('vim.api.nvim_buf_call(0, function() end)')
eq('v', fn.mode())
-- The callback ends Visual mode: it must STAY ended.
exec_lua([[vim.api.nvim_buf_call(0, function() vim.cmd('normal! \27') end)]])
eq('n', fn.mode())
end)
it('supports multiple returns', function()
local curbuf = api.nvim_get_current_buf()
local other = api.nvim_create_buf(false, true)