mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 02:38:46 +00:00
fix(picker): multi layouts that need async task work again.
This commit is contained in:
parent
8dea225209
commit
cd44efb60c
4 changed files with 8 additions and 5 deletions
|
@ -134,7 +134,7 @@ function M.multi(opts)
|
|||
fopts = Snacks.config.merge({}, vim.deepcopy(source), fopts)
|
||||
-- Update source filter when needed
|
||||
if not vim.tbl_isempty(fopts.filter or {}) then
|
||||
ctx = ctx:clone()
|
||||
ctx = setmetatable({}, { __index = ctx })
|
||||
ctx.filter = ctx.filter:clone():init(fopts)
|
||||
end
|
||||
return finder(fopts, ctx)
|
||||
|
|
|
@ -13,7 +13,6 @@ M.__index = M
|
|||
---@field filter snacks.picker.Filter
|
||||
---@field async snacks.picker.Async
|
||||
---@field meta table<string, any>
|
||||
---@field clone fun(self:snacks.picker.finder.ctx): snacks.picker.finder.ctx
|
||||
|
||||
---@alias snacks.picker.finder.async fun(cb:async fun(item:snacks.picker.finder.Item))
|
||||
---@alias snacks.picker.finder.result snacks.picker.finder.Item[] | snacks.picker.finder.async
|
||||
|
@ -67,9 +66,6 @@ function M:ctx(picker)
|
|||
}),
|
||||
filter = self.filter,
|
||||
meta = {},
|
||||
clone = function(t)
|
||||
return Snacks.picker.util.shallow_copy(t) --[[@as snacks.picker.finder.ctx]]
|
||||
end,
|
||||
}
|
||||
setmetatable(ret, { __index = M:deprecated(self.filter) })
|
||||
return ret
|
||||
|
|
|
@ -32,6 +32,9 @@ function M.get(opts)
|
|||
if win == 0 or not vim.api.nvim_win_is_valid(win) then
|
||||
return false
|
||||
end
|
||||
if vim.w[win].snacks_layout then
|
||||
return false
|
||||
end
|
||||
-- exclude non-file buffers
|
||||
if opts.file and vim.bo[vim.api.nvim_win_get_buf(win)].buftype ~= "" then
|
||||
return false
|
||||
|
|
|
@ -73,6 +73,10 @@ function State:follow()
|
|||
if not picker or picker:is_focused() or picker.closed then
|
||||
return
|
||||
end
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
if vim.api.nvim_win_get_config(win).relative ~= "" then
|
||||
return
|
||||
end
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
local file = vim.api.nvim_buf_get_name(buf)
|
||||
self:show(file)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue