mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 02:38:46 +00:00
fix(picker.list): keep existing target if it exists unless force = true
. Closes #1152
Some checks failed
CI / ci (push) Failing after 0s
Some checks failed
CI / ci (push) Failing after 0s
This commit is contained in:
parent
031f9e96fb
commit
121e74e4a5
1 changed files with 6 additions and 1 deletions
|
@ -169,9 +169,14 @@ end
|
|||
|
||||
--- Sets the target cursor/top for the next render.
|
||||
--- Useful to keep the cursor/top, right before triggering a `find`.
|
||||
--- If an existing target is set, it will be kept, unless `opts.force` is set.
|
||||
---@param cursor? number
|
||||
---@param top? number
|
||||
function M:set_target(cursor, top)
|
||||
---@param opts? {force?: boolean}
|
||||
function M:set_target(cursor, top, opts)
|
||||
if self.target and not (opts and opts.force) then
|
||||
return
|
||||
end
|
||||
self.target = { cursor = cursor or self.cursor, top = top or self.top }
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue