···149149 return Picker:new(...):open()
150150end
151151152152+---@param fn artio.Picker.action
153153+---@param scheduled_fn? artio.Picker.action
154154+artio.wrap = function(fn, scheduled_fn)
155155+ return function()
156156+ local Picker = require("artio.picker")
157157+ local current = Picker.active_picker
158158+ if not current or current.closed then
159159+ return
160160+ end
161161+162162+ -- whether to accept key inputs
163163+ if coroutine.status(current.co) ~= "suspended" then
164164+ return
165165+ end
166166+167167+ pcall(fn, current)
168168+169169+ if scheduled_fn == nil then
170170+ return
171171+ end
172172+ vim.schedule(function()
173173+ pcall(scheduled_fn, current)
174174+ end)
175175+ end
176176+end
177177+152178return artio