mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 03:08:13 +00:00
fix(picker): don't jump to invalid positions. Fixes #712
This commit is contained in:
parent
f57350f1d1
commit
51adb6792e
2 changed files with 2 additions and 2 deletions
|
@ -77,7 +77,7 @@ function M.jump(picker, _, action)
|
|||
vim.api.nvim_win_set_buf(win, buf)
|
||||
|
||||
-- set the cursor
|
||||
if item.pos then
|
||||
if item.pos and item.pos[1] > 0 then
|
||||
vim.api.nvim_win_set_cursor(win, { item.pos[1], item.pos[2] })
|
||||
elseif item.search then
|
||||
vim.cmd(item.search)
|
||||
|
|
|
@ -54,7 +54,7 @@ function M.filename(item, picker)
|
|||
else
|
||||
ret[#ret + 1] = { path, "SnacksPickerFile", field = "file" }
|
||||
end
|
||||
if item.pos then
|
||||
if item.pos and item.pos[1] > 0 then
|
||||
ret[#ret + 1] = { ":", "SnacksPickerDelim" }
|
||||
ret[#ret + 1] = { tostring(item.pos[1]), "SnacksPickerRow" }
|
||||
if item.pos[2] > 0 then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue