feat(pos): vim.pos.cursor() without args returns curwin pos #40975

This commit is contained in:
Olivia Kinnear
2026-07-28 06:21:45 -05:00
committed by GitHub
parent 59296a9fef
commit 5226e26e99
4 changed files with 13 additions and 8 deletions

View File

@@ -32,12 +32,13 @@ describe('vim.pos', function()
end)
it('creates a position from the window cursor', function()
local pos, buf = exec_lua(function()
local pos, pos_default, buf = exec_lua(function()
vim.api.nvim_buf_set_lines(0, 0, -1, true, { 'first', 'second' })
vim.api.nvim_win_set_cursor(0, { 2, 3 })
return vim.pos.cursor(0), vim.api.nvim_get_current_buf()
return vim.pos.cursor(0), vim.pos.cursor(), vim.api.nvim_get_current_buf()
end)
eq({ 1, 3, buf }, pos)
eq({ 1, 3, buf }, pos_default)
end)
it('comparisons by overloaded operators', function()