diff --git a/lua/noice/message/router.lua b/lua/noice/message/router.lua index 136e8371..44a8c503 100644 --- a/lua/noice/message/router.lua +++ b/lua/noice/message/router.lua @@ -188,7 +188,7 @@ function M.update() message = messages, }, }, { messages = view._messages }) - if #view._messages ~= count then + if #view._messages ~= count or view._dirty then updates[view] = true end end @@ -211,11 +211,17 @@ function M.update() Manager.clear() + local dirty = false for view, _ in pairs(updates) do view:display() + if view._dirty then + dirty = true + end end - M._tick = Manager.tick() + if not dirty then + M._tick = Manager.tick() + end if not vim.tbl_isempty(updates) then Util.stats.track("router.update.updated") diff --git a/lua/noice/view/init.lua b/lua/noice/view/init.lua index 00f07fc1..dbe2fca4 100644 --- a/lua/noice/view/init.lua +++ b/lua/noice/view/init.lua @@ -26,6 +26,7 @@ local Format = require("noice.text.format") ---@field _route_opts NoiceViewOptions ---@field _visible boolean ---@field _instance "opts" | "view" | "backend" +---@field _dirty boolean? ---@overload fun(opts?: NoiceViewOptions): NoiceView local View = Object("NoiceView") @@ -137,7 +138,11 @@ function View:display() Format.align(self._messages, self._opts.align) self:check_options() - Util.try(self.show, self) + Util.try(function() + self._dirty = true + self:show() + self._dirty = false + end) self._visible = true else