mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
fix(picker.undo): use new API. Closes #707
This commit is contained in:
parent
d673cbd5d1
commit
79a6eabd31
1 changed files with 5 additions and 6 deletions
|
@ -324,7 +324,7 @@ function M.spelling()
|
|||
end
|
||||
|
||||
---@type snacks.picker.finder
|
||||
function M.undo()
|
||||
function M.undo(opts, ctx)
|
||||
local tree = vim.fn.undotree()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
|
@ -423,10 +423,9 @@ function M.undo()
|
|||
|
||||
-- Resolve the items in batches to prevent blocking the UI
|
||||
---@param cb async fun(item: snacks.picker.finder.Item)
|
||||
---@param task snacks.picker.Async
|
||||
---@async
|
||||
return function(cb, task)
|
||||
task:on("abort", vim.schedule_wrap(restore))
|
||||
return function(cb)
|
||||
ctx.async:on("abort", vim.schedule_wrap(restore))
|
||||
|
||||
while #items > 0 do
|
||||
vim.schedule(function()
|
||||
|
@ -440,9 +439,9 @@ function M.undo()
|
|||
if #items == 0 then
|
||||
restore()
|
||||
end
|
||||
task:resume()
|
||||
ctx.async:resume()
|
||||
end)
|
||||
task:suspend()
|
||||
ctx.async:suspend()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue