🐻 minimal ui2 fuzzy finder for Neovim codeberg.org/comfysage/artio.nvim
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(picker): use thread handle

robin 721355ee 8aedc0cd

+9 -8
+9 -8
lua/artio/picker.lua
··· 27 27 ---@field mappings? table<string, 'up'|'down'|'accept'|'cancel'|'togglepreview'|string> 28 28 29 29 ---@class artio.Picker : artio.Picker.config 30 - ---@field co thread|nil 30 + ---@field co thread? 31 + ---@field thread function 31 32 ---@field input string 32 33 ---@field liveinput? string 33 34 ---@field idx integer 1-indexed ··· 74 75 return setmetatable(t, Picker) 75 76 end 76 77 78 + ---@enum artio.Picker.Action 77 79 local action_enum = { 78 80 accept = 0, 79 81 cancel = 1, ··· 87 89 88 90 self.view = View:new(self) 89 91 90 - coroutine.wrap(function() 92 + self.thread = coroutine.wrap(function() 91 93 self.view:open() 92 94 93 95 self:initkeymaps() 94 96 95 - local co, ismain = coroutine.running() 96 - assert(not ismain, "must be called from a coroutine") 97 - self.co = co 97 + self.co = coroutine.running() 98 98 99 99 vim.api.nvim_exec_autocmds("User", { pattern = "ArtioEnter" }) 100 100 ··· 124 124 end 125 125 126 126 vim.api.nvim_exec_autocmds("User", { pattern = "ArtioLeave" }) 127 - end)() 127 + end) 128 + self.thread() 128 129 end 129 130 130 131 function Picker:resume() ··· 199 200 end 200 201 201 202 function Picker:accept() 202 - coroutine.resume(self.co, action_enum.accept) 203 + self.thread(action_enum.accept) 203 204 end 204 205 205 206 function Picker:cancel() 206 - coroutine.resume(self.co, action_enum.cancel) 207 + self.thread(action_enum.cancel) 207 208 end 208 209 209 210 function Picker:fix()