🐻 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(view): clean up close logic

robin f77e15e4 f5347f6b

+39 -3
+39 -3
lua/artio/view.lua
··· 263 263 cmdline.cmdline_show = self.prev_show 264 264 self:closepreview() 265 265 vim.schedule(function() 266 + pcall(vim.api.nvim_del_augroup_by_id, self.augroup) 267 + 266 268 vim.cmd.stopinsert() 269 + 270 + -- prepare state 267 271 self:revertopts() 272 + 273 + -- reset state 268 274 self:clear() 269 275 cmdline.srow = 0 270 276 cmdline.erow = 0 271 - win_config(ext.wins.cmd, true, ext.cmdheight) 277 + 278 + -- restore ui 279 + self:hide() 272 280 self:restoreview() 273 281 vim.cmd.redraw() 274 - cmdline.cmdline_block_hide() 275 - pcall(vim.api.nvim_del_augroup_by_id, self.augroup) 282 + 276 283 self.closed = true 277 284 end) 285 + end 286 + 287 + function View:hide() 288 + vim.fn.clearmatches(ext.wins.cmd) -- Clear matchparen highlights. 289 + vim.api.nvim_win_set_cursor(ext.wins.cmd, { 1, 0 }) 290 + vim.api.nvim_buf_set_lines(ext.bufs.cmd, 0, -1, false, {}) 291 + 292 + local clear = vim.schedule_wrap(function(was_prompt) 293 + -- Avoid clearing prompt window when it is re-entered before the next event 294 + -- loop iteration. E.g. when a non-choice confirm button is pressed. 295 + if was_prompt and not cmdline.prompt then 296 + pcall(function() 297 + vim.api.nvim_buf_set_lines(ext.bufs.cmd, 0, -1, false, {}) 298 + vim.api.nvim_buf_set_lines(ext.bufs.dialog, 0, -1, false, {}) 299 + vim.api.nvim_win_set_config(ext.wins.dialog, { hide = true }) 300 + vim.on_key(nil, ext.msg.dialog_on_key) 301 + end) 302 + end 303 + -- Messages emitted as a result of a typed command are treated specially: 304 + -- remember if the cmdline was used this event loop iteration. 305 + -- NOTE: Message event callbacks are themselves scheduled, so delay two iterations. 306 + vim.schedule(function() 307 + cmdline.level = -1 308 + end) 309 + end) 310 + clear(cmdline.prompt) 311 + 312 + cmdline.prompt, cmdline.level = false, 0 313 + win_config(ext.wins.cmd, true, ext.cmdheight) 278 314 end 279 315 280 316 function View:update()