minimal extui fuzzy finder for neovim

fix(picker): create `Picker:accept()` and `Picker:cancel()`

+15 -7
+8
lua/artio/picker.lua
··· 164 164 end) 165 165 end 166 166 167 + function Picker:accept() 168 + coroutine.resume(self.co, action_enum.accept) 169 + end 170 + 171 + function Picker:cancel() 172 + coroutine.resume(self.co, action_enum.cancel) 173 + end 174 + 167 175 function Picker:fix() 168 176 self.idx = math.max(self.idx, self.opts.preselect and 1 or 0) 169 177 self.idx = math.min(self.idx, #self.matches)
+5 -5
lua/artio/utils.lua
··· 42 42 return qfitem 43 43 end) 44 44 :totable()) 45 - coroutine.resume(self.co, 1) 45 + self:cancel() 46 46 end, function(_) 47 47 vim.cmd.copen() 48 48 end) ··· 60 60 return qfitem 61 61 end) 62 62 :totable()) 63 - coroutine.resume(self.co, 1) 63 + self:cancel() 64 64 end, function(_) 65 65 vim.cmd.copen() 66 66 end) ··· 80 80 function utils.make_fileactions(fn) 81 81 return { 82 82 split = require("artio").wrap(function(self) 83 - coroutine.resume(self.co, 1) 83 + self:cancel() 84 84 end, function(self) 85 85 local item = self:getcurrent() 86 86 if not item then ··· 90 90 vim.api.nvim_open_win(buf, true, { win = -1, vertical = false }) 91 91 end), 92 92 vsplit = require("artio").wrap(function(self) 93 - coroutine.resume(self.co, 1) 93 + self:cancel() 94 94 end, function(self) 95 95 local item = self:getcurrent() 96 96 if not item then ··· 100 100 vim.api.nvim_open_win(buf, true, { win = -1, vertical = true }) 101 101 end), 102 102 tabnew = require("artio").wrap(function(self) 103 - coroutine.resume(self.co, 1) 103 + self:cancel() 104 104 end, function(self) 105 105 local item = self:getcurrent() 106 106 if not item then
+2 -2
plugin/artio.lua
··· 96 96 "i", 97 97 "<Plug>(artio-action-accept)", 98 98 wrap(function(self) 99 - coroutine.resume(self.co, 0) 99 + self:accept() 100 100 end) 101 101 ) 102 102 vim.keymap.set( 103 103 "i", 104 104 "<Plug>(artio-action-cancel)", 105 105 wrap(function(self) 106 - coroutine.resume(self.co, 1) 106 + self:cancel() 107 107 end) 108 108 ) 109 109 vim.keymap.set(