Skip to content

Commit

Permalink
fix(ui): dont try updating the ui during textlock
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 18, 2024
1 parent 217c684 commit 4ef75a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 10 additions & 2 deletions lua/noice/ui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,16 @@ function M.enable()

-- check if we need to update the ui
if Manager.tick() > tick then
-- Util.debug(vim.inspect({ event, stack_level, Util.is_blocking(), tick, kind, ... }))
if Util.is_blocking() and event ~= "msg_ruler" and kind ~= "search_count" then
Util.debug(function()
local _, blocking = Util.is_blocking()
return { event, "sl:" .. stack_level, "tick:" .. tick, blocking or false, kind }
end)
if
require("noice.util.ffi").textlock == 0
and Util.is_blocking()
and event ~= "msg_ruler"
and kind ~= "search_count"
then
Util.try(Router.update)
end
else
Expand Down
5 changes: 1 addition & 4 deletions lua/noice/util/ffi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function M.load()
} HlAttrs;
HlAttrs syn_attr2entry(int attr);
bool cmdpreview;
extern int textlock;
void setcursor_mayforce(bool force);
]]
)
Expand All @@ -31,10 +32,6 @@ end

return setmetatable(M, {
__index = function(_, key)
-- HACK: cmdpreview symbol is not available on Windows
if vim.fn.has("nvim-0.9.0") ~= 1 and key == "cmdpreview" and jit.os == "Windows" then
return false
end
return M.load()[key]
end,
__newindex = function(_, k, v)
Expand Down

0 comments on commit 4ef75a3

Please sign in to comment.