fix(picker.list): keep existing target if it exists unless force = true. Closes #1152
Some checks failed
CI / ci (push) Failing after 0s

This commit is contained in:
Folke Lemaitre 2025-02-13 22:11:03 +01:00
parent 031f9e96fb
commit 121e74e4a5
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -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