fix(lua): don't clamp -1 or v:maxcol in vim.highlight.range() (#29203)

This commit is contained in:
zeertzjq
2024-06-05 16:47:43 +08:00
committed by GitHub
parent e41597c510
commit 43bd9c9c1c
2 changed files with 46 additions and 10 deletions

View File

@@ -90,6 +90,22 @@ describe('vim.highlight.range', function()
|
]])
end)
it('can use -1 or v:maxcol to indicate end of line', function()
exec_lua([[
local ns = vim.api.nvim_create_namespace('')
vim.highlight.range(0, ns, 'Search', { 0, 4 }, { 1, -1 }, {})
vim.highlight.range(0, ns, 'Search', { 2, 6 }, { 3, vim.v.maxcol }, {})
]])
screen:expect([[
^asdf{10:ghjkl}{100:$} |
{10:«口=口»}{100:$} |
qwerty{10:uiop}{100:$} |
{10:口口=口口}{1:$} |
zxcvbnm{1:$} |
|
]])
end)
end)
describe('vim.highlight.on_yank', function()