mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
refactor(picker): on_move => on_change
This commit is contained in:
parent
6a523768cf
commit
e390b7d874
3 changed files with 4 additions and 4 deletions
|
@ -74,7 +74,7 @@ local M = {}
|
|||
---@field sources? snacks.picker.sources.Config|{}
|
||||
---@field icons? snacks.picker.icons
|
||||
---@field source? string
|
||||
---@field on_moved? fun(picker:snacks.Picker, item:snacks.picker.Item)
|
||||
---@field on_change? fun(picker:snacks.Picker, item:snacks.picker.Item) called when the cursor changes
|
||||
---@field layouts? table<string, snacks.picker.Layout>
|
||||
local defaults = {
|
||||
prompt = " ",
|
||||
|
|
|
@ -425,7 +425,7 @@ M.picker_format = {
|
|||
M.picker_layouts = {
|
||||
finder = "meta_layouts",
|
||||
format = "text",
|
||||
on_moved = function(picker, item)
|
||||
on_change = function(picker, item)
|
||||
vim.schedule(function()
|
||||
picker:set_layout(item.text)
|
||||
end)
|
||||
|
|
|
@ -244,8 +244,8 @@ function M:debug(name, start)
|
|||
end
|
||||
|
||||
function M:show_preview()
|
||||
if self.opts.on_moved then
|
||||
self.opts.on_moved(self, self:current())
|
||||
if self.opts.on_change then
|
||||
self.opts.on_change(self, self:current())
|
||||
end
|
||||
if not self.preview.win:valid() then
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue