Skip to content

Commit

Permalink
fix: redraw flush when needed. Fixes #938
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Nov 2, 2024
1 parent 973e10a commit c897bc8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions lua/noice/message/router.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ function M.update()
if not vim.tbl_isempty(updates) then
Util.stats.track("router.update.updated")
M._need_redraw = true
Util.redraw()
end

M._updating = false
Expand Down
6 changes: 1 addition & 5 deletions lua/noice/util/hacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ function M.fix_redraw()
return timer:stop()
end
if not Util.is_search() then
if vim.api.nvim__redraw then
vim.api.nvim__redraw({ flush = true })
else
vim.cmd.redraw()
end
Util.redraw()
end
end)
)
Expand Down
10 changes: 8 additions & 2 deletions lua/noice/util/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,14 @@ function M.is_blocking(opts)
return reason ~= nil, reason
end

function M.redraw()
vim.cmd.redraw()
---@param opts? vim.api.keyset.redraw
function M.redraw(opts)
if vim.api.nvim__redraw then
opts = opts or { flush = true }
vim.api.nvim__redraw(opts)
else
vim.cmd.redraw()
end
M.stats.track("redraw")
end

Expand Down

0 comments on commit c897bc8

Please sign in to comment.