mirror of
https://github.com/neovim/neovim.git
synced 2026-06-16 16:51:19 +00:00
feat(vim.pos): accept buf=0 for current buf #39414
This commit is contained in:
committed by
Justin M. Keyes
parent
828a35b14f
commit
49efe692f3
@@ -20,6 +20,15 @@ describe('vim.pos', function()
|
||||
eq(buf, pos[3])
|
||||
end)
|
||||
|
||||
it('creates a position with buf=0', function()
|
||||
local pos, buf = exec_lua(function()
|
||||
return vim.pos(0, 3, 5), vim.api.nvim_get_current_buf()
|
||||
end)
|
||||
eq(3, pos[1])
|
||||
eq(5, pos[2])
|
||||
eq(buf, pos[3])
|
||||
end)
|
||||
|
||||
it('comparisons by overloaded operators', function()
|
||||
local buf = exec_lua(function()
|
||||
return vim.api.nvim_create_buf(false, true)
|
||||
|
||||
@@ -22,6 +22,17 @@ describe('vim.range', function()
|
||||
eq(buf, range[5])
|
||||
end)
|
||||
|
||||
it('creates a range with buf=0', function()
|
||||
local range, buf = exec_lua(function()
|
||||
return vim.range(0, 3, 5, 4, 6), vim.api.nvim_get_current_buf()
|
||||
end)
|
||||
eq(3, range[1])
|
||||
eq(5, range[2])
|
||||
eq(4, range[3])
|
||||
eq(6, range[4])
|
||||
eq(buf, range[5])
|
||||
end)
|
||||
|
||||
it('creates a range from two positions', function()
|
||||
local range, buf1 = exec_lua(function()
|
||||
local buf = vim.api.nvim_create_buf(false, true)
|
||||
|
||||
Reference in New Issue
Block a user