fix(picker.actions): fix qflist position (#911)

vim.fn.setqflist() and vim.fn.setloclist() use (1,1)-indexing, but
vim.api.nvim_win_set_cursor() uses (1,0)-indexing. Adjust for this when
sending items to qflist/loclist.
This commit is contained in:
jdrouhard 2025-02-04 14:56:18 -06:00 committed by GitHub
parent 94bd2eff74
commit 6d3c135235
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -294,9 +294,9 @@ local function setqflist(items, opts)
filename = Snacks.picker.util.path(item), filename = Snacks.picker.util.path(item),
bufnr = item.buf, bufnr = item.buf,
lnum = item.pos and item.pos[1] or 1, lnum = item.pos and item.pos[1] or 1,
col = item.pos and item.pos[2] or 1, col = item.pos and item.pos[2] + 1 or 1,
end_lnum = item.end_pos and item.end_pos[1] or nil, end_lnum = item.end_pos and item.end_pos[1] or nil,
end_col = item.end_pos and item.end_pos[2] or nil, end_col = item.end_pos and item.end_pos[2] + 1 or nil,
text = item.line or item.comment or item.label or item.name or item.detail or item.text, text = item.line or item.comment or item.label or item.name or item.detail or item.text,
pattern = item.search, pattern = item.search,
valid = true, valid = true,