feat(picker): opts.on_close

This commit is contained in:
Folke Lemaitre 2025-02-04 17:09:47 +01:00
parent b773368f8a
commit 6235f44b11
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 5 additions and 0 deletions

View file

@ -99,6 +99,7 @@ local M = {}
---@field main? snacks.picker.main.Config main editor window config
---@field on_change? fun(picker:snacks.Picker, item?:snacks.picker.Item) called when the cursor changes
---@field on_show? fun(picker:snacks.Picker) called when the picker is shown
---@field on_close? fun(picker:snacks.Picker) called when the picker is closed
---@field jump? snacks.picker.jump.Config|{}
--- Other
---@field config? fun(opts:snacks.picker.Config):snacks.picker.Config? custom config function

View file

@ -590,6 +590,10 @@ function M:close()
return
end
if self.opts.on_close then
self.opts.on_close(self)
end
self:hist_record(true)
self.closed = true