fix(diagnostic): fix navigation with diagnostics placed past end of line

This commit is contained in:
Gregory Anders
2021-11-19 11:31:33 -07:00
parent 2abc799ffd
commit 34bb5fa5a9
2 changed files with 16 additions and 2 deletions

View File

@@ -686,6 +686,19 @@ describe('vim.diagnostic', function()
return vim.diagnostic.get_prev_pos { namespace = diagnostic_ns }
]])
end)
it('works with diagnostics past the end of the line #16349', function()
eq({4, 0}, exec_lua [[
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {
make_error('Diagnostic #1', 3, 9001, 3, 9001),
make_error('Diagnostic #2', 4, 0, 4, 0),
})
vim.api.nvim_win_set_buf(0, diagnostic_bufnr)
vim.api.nvim_win_set_cursor(0, {1, 1})
vim.diagnostic.goto_next { float = false }
return vim.diagnostic.get_next_pos { namespace = diagnostic_ns }
]])
end)
end)
describe('get_prev_pos()', function()