diff --git a/main.lua b/main.lua index 289c982..0109c1a 100644 --- a/main.lua +++ b/main.lua @@ -48,17 +48,67 @@ local IrcChatView = TextViewer:extend{ } function IrcChatView:init(reinit) - -- Buttons: Send, Close - self.buttons_table = { + -- Mark UI as open so append/refresh paths repaint immediately + self._ui_open = true + -- Build buttons: first our Send row, then TextViewer's default row + -- Disable TextViewer's automatic default buttons to avoid duplication + self.add_default_buttons = false + local send_row = { { - { - text = _("Send"), - callback = function() - self:promptSendMessage() - end, - }, - } + text = _("Send"), + callback = function() + self:promptSendMessage() + end, + }, } + local default_row = { + { + text = _("Find"), + id = "find", + callback = function() + if self._find_next then + self:findCallback() + else + self:findDialog() + end + end, + hold_callback = function() + if self._find_next then + self:findDialog() + else + if self.default_hold_callback then + self.default_hold_callback() + end + end + end, + }, + { + text = "⇱", + id = "top", + callback = function() + if self.scroll_text_w then self.scroll_text_w:scrollToTop() end + end, + hold_callback = self.default_hold_callback, + allow_hold_when_disabled = true, + }, + { + text = "⇲", + id = "bottom", + callback = function() + if self.scroll_text_w then self.scroll_text_w:scrollToBottom() end + end, + hold_callback = self.default_hold_callback, + allow_hold_when_disabled = true, + }, + { + text = _("Close"), + callback = function() + self:onClose() + end, + hold_callback = self.default_hold_callback, + }, + } + self.buttons_table = { send_row, default_row } -- Buffers & title if not reinit then self._buffers = {}