irc: send before closing dialog and force a post-close refresh; add refreshView helper
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
25
main.lua
25
main.lua
@@ -427,8 +427,15 @@ function IrcChatView:promptSendMessage()
|
|||||||
is_default = true,
|
is_default = true,
|
||||||
callback = function()
|
callback = function()
|
||||||
local txt = dialog:getInputText()
|
local txt = dialog:getInputText()
|
||||||
UIManager:close(dialog)
|
-- Update buffer/UI before closing dialog to ensure immediate repaint
|
||||||
self:sendMessage(txt)
|
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,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -444,6 +451,22 @@ function IrcChatView:promptSendMessage()
|
|||||||
dialog:onShowKeyboard(true)
|
dialog:onShowKeyboard(true)
|
||||||
end
|
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()
|
function IrcChatView:receiveLoop()
|
||||||
if self._closing then return end
|
if self._closing then return end
|
||||||
if not self._sock then return end
|
if not self._sock then return end
|
||||||
|
|||||||
Reference in New Issue
Block a user