minimal extui fuzzy finder for neovim

feat(picker): exec `ArtioEnter` and `ArtioLeave` autocmds

+20 -12
+20 -12
lua/artio/picker.lua
··· 84 84 assert(not ismain, "must be called from a coroutine") 85 85 self.co = co 86 86 87 + vim.api.nvim_exec_autocmds("User", { pattern = "ArtioEnter" }) 88 + 87 89 local result = coroutine.yield() 88 90 89 91 self:close() 90 92 91 - if result == action_enum.cancel or result ~= action_enum.accept then 92 - if self.on_quit then 93 - self.on_quit() 93 + while true do 94 + if result == action_enum.cancel or result ~= action_enum.accept then 95 + if self.on_quit then 96 + self.on_quit() 97 + end 98 + break 94 99 end 95 - return 96 - end 97 100 98 - local current = self.matches[self.idx] and self.matches[self.idx][1] 99 - if not current then 100 - return 101 - end 101 + local current = self.matches[self.idx] and self.matches[self.idx][1] 102 + if not current then 103 + break 104 + end 102 105 103 - local item = self.items[current] 104 - if item then 105 - self.on_close(item.v, item.id) 106 + local item = self.items[current] 107 + if item then 108 + self.on_close(item.v, item.id) 109 + end 110 + 111 + break 106 112 end 113 + 114 + vim.api.nvim_exec_autocmds("User", { pattern = "ArtioLeave" }) 107 115 end)() 108 116 end 109 117