diff --git a/main.lua b/main.lua index 11f3437..acdecd7 100644 --- a/main.lua +++ b/main.lua @@ -427,8 +427,15 @@ function IrcChatView:promptSendMessage() is_default = true, callback = function() local txt = dialog:getInputText() - UIManager:close(dialog) + -- Update buffer/UI before closing dialog to ensure immediate repaint self:sendMessage(txt) + UIManager:close(dialog) + -- And schedule a focused refresh after the dialog is gone + if UIManager and self._ui_open then + UIManager:nextTick(function() + self:refreshView(self._current_target or "*") + end) + end end, }, { @@ -444,6 +451,22 @@ function IrcChatView:promptSendMessage() dialog:onShowKeyboard(true) end +function IrcChatView:refreshView(target) + target = target or self._current_target or "*" + if not self._ui_open then return end + self:preloadHistory(target) + if self.scroll_text_w and self.scroll_text_w.text_widget then + self.scroll_text_w.text_widget:setText(self._buffers[target] or "") + self.scroll_text_w:scrollToBottom() + if self.scroll_text_w.updateScrollBar then + self.scroll_text_w:updateScrollBar(true) + end + end + if UIManager and self.frame and self.frame.dimen then + UIManager:setDirty(self, function() return "ui", self.frame.dimen end) + end +end + function IrcChatView:receiveLoop() if self._closing then return end if not self._sock then return end