From 83b104cced0d2fcc964ece88d3125fe391e04a75 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 9 Mar 2026 17:31:10 -0400 Subject: [PATCH] fix(select): redraw screen after buffer switch Problem: `select` opens files inside a `vim.schedule_wrap` callback from `normalize_url`. Scheduled `FileType` autocmds (e.g. treesitter parsing) queue onto the same batch, blocking the screen update. The oil buffer stays visible until the heavy work finishes. Solution: call `vim.cmd.redraw()` after the buffer switch to flush the screen before any queued scheduled callbacks run. Matches the behavior of plain `:e`. --- lua/canola/init.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/canola/init.lua b/lua/canola/init.lua index e556920..6c6f818 100644 --- a/lua/canola/init.lua +++ b/lua/canola/init.lua @@ -870,8 +870,6 @@ M.select = function(opts, callback) local filebufnr = vim.fn.bufadd(normalized_url) local entry_is_file = not vim.endswith(normalized_url, '/') - -- The :buffer command doesn't set buflisted=true - -- So do that for normal files or for canola dirs if config set buflisted=true if entry_is_file or config.buf_options.buflisted then vim.bo[filebufnr].buflisted = true end @@ -879,7 +877,6 @@ M.select = function(opts, callback) local cmd = 'buffer' if opts.tab then vim.cmd.tabnew({ mods = mods }) - -- Make sure the new buffer from tabnew gets cleaned up vim.bo.bufhidden = 'wipe' elseif opts.split then cmd = 'sbuffer' @@ -893,12 +890,12 @@ M.select = function(opts, callback) args = { filebufnr }, mods = mods, }) - -- Ignore swapfile errors if not ok and err and not err:match('^Vim:E325:') then vim.api.nvim_echo({ { err, 'Error' } }, true, {}) end end + vim.cmd.redraw() open_next_entry(cb) end) end