Skip to content

Commit

Permalink
fix: race condition when stopping loading timer (#331)
Browse files Browse the repository at this point in the history
On Neovim 0.10, calling timer:stop() is not canceling the callback.
There appears to be some minimum amount of buffer time remaining in the
timer in order for it to be able to be canceled correctly. I'm getting
around this by adding a simple guard statement
  • Loading branch information
stevearc committed Jan 21, 2024
1 parent 8ccc180 commit cf69a43
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/aerial/loading.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ M.set_loading = function(aer_bufnr, is_loading)
0,
80,
vim.schedule_wrap(function()
if not timers[aer_bufnr] then
return
end
local lines = { M.spinner_frames[i + 1] .. " Loading" }
util.render_centered_text(aer_bufnr, lines)
i = (i + 1) % #M.spinner_frames
Expand Down

0 comments on commit cf69a43

Please sign in to comment.