diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-07-09 19:50:16 +0200 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2026-07-10 03:27:37 +0200 |
| commit | 6bb1aa74e6fe26bffbbdb91878f8f07477c01fcc (patch) | |
| tree | 38615f7ef031f6e9f9738254c0a3ae84d3e3dea7 /test/functional/api/buffer_spec.lua | |
| parent | 982d2f253168be9dbfecd0c1a41ec9cff8017a4e (diff) | |
| download | rneovim-6bb1aa74e6fe26bffbbdb91878f8f07477c01fcc.tar.gz rneovim-6bb1aa74e6fe26bffbbdb91878f8f07477c01fcc.tar.bz2 rneovim-6bb1aa74e6fe26bffbbdb91878f8f07477c01fcc.zip | |
refactor: unify context-switching concepts
Diffstat (limited to 'test/functional/api/buffer_spec.lua')
| -rw-r--r-- | test/functional/api/buffer_spec.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua index a81c1ed1c7..1ed77c41ff 100644 --- a/test/functional/api/buffer_spec.lua +++ b/test/functional/api/buffer_spec.lua @@ -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) |