Skip to content

Commit

Permalink
fix(ui_attach): dont update router during ext_messages and disable/…
Browse files Browse the repository at this point in the history
…enable Noice during confirm. #298
  • Loading branch information
folke committed Jan 13, 2023
1 parent 36eabb6 commit a4cbc0f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lua/noice/ui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ function M.enable()
local stack_level = 0

---@diagnostic disable-next-line: redundant-parameter
vim.ui_attach(Config.ns, options, function(event, ...)
local handler = M.get_handler(event, ...)
vim.ui_attach(Config.ns, options, function(event, kind, ...)
local handler = M.get_handler(event, kind, ...)

if not handler then
return
Expand All @@ -84,13 +84,18 @@ function M.enable()
stack_level = stack_level + 1

local tick = Manager.tick()
safe_handle(handler, event, ...)
safe_handle(handler, event, kind, ...)

-- check if we need to update the ui
if Manager.tick() > tick then
-- Util.debug(vim.inspect({ event, tick, ... }))
-- Util.debug(vim.inspect({ event, tick, kind, ... }))
if Util.is_blocking() then
Util.try(Router.update)
if event ~= "msg_show" then
Util.try(Router.update)
elseif kind == "confirm" then
M.disable()
vim.schedule(M.enable)
end
end
else
local widget = M.parse_event(event)
Expand Down

0 comments on commit a4cbc0f

Please sign in to comment.