From 796f20eadf4799c0f688f3a2a75b6d4a2cc0550d Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Fri, 30 Oct 2026 00:38:54 -0500 Subject: [PATCH] Show chat copy and the share box in ClassicAPI's scrolling edit box pfUIScrollingEditBoxTemplate (api/ui-widgets.xml) is ScrollingEditBoxTemplate with pfUIScrollBarTemplate beside the text. Its mixin's SetFont gives the box a font object of its own, since the edit box sets its font by object on every SetText and pfUI fonts are paths. ui-widgets.lua now loads before the XML, which needs the mixin. The share box no longer recomputes its scroll child on every text change. Chat copy reads each chat frame's messages with ClassicAPI's GetMessageInfo when it opens, so the AddMessage hook, its 100-line copy of the history and the skip of combat frames are gone. It shows every line the frame keeps, lines from before login included. It puts the caret at the end to scroll to the newest line instead of three OnUpdate passes, and Escape now leaves copy mode on every chat frame. --- api/ui-widgets.lua | 24 +++++++ api/ui-widgets.xml | 22 +++++++ init/api.xml | 2 +- modules/chatcopy.lua | 153 +++++++++++++------------------------------ modules/share.lua | 50 +++++--------- 5 files changed, 111 insertions(+), 140 deletions(-) diff --git a/api/ui-widgets.lua b/api/ui-widgets.lua index 7b7c3165..f431b99b 100644 --- a/api/ui-widgets.lua +++ b/api/ui-widgets.lua @@ -427,6 +427,30 @@ function pfUI.api.CreateTabFrame(parent, align, outside) return f end +-- [ pfUIScrollingEditBoxTemplate ] +-- Mixin of the template in ui-widgets.xml: ClassicAPI's scrolling edit box +-- with pfUI's scroll bar beside it. +_G.pfUIScrollingEditBoxMixin = {} + +function pfUIScrollingEditBoxMixin:InitScrollBar() + local scrollBox = self:GetScrollBox() + scrollBox:ClearAllPoints() + scrollBox:SetPoint("TOPLEFT") + scrollBox:SetPoint("BOTTOMRIGHT", self.ScrollBar, "BOTTOMLEFT") + ScrollUtil.RegisterScrollBoxWithScrollBar(scrollBox, self.ScrollBar) +end + +-- The edit box takes its font from a font object and sets that object again +-- on every SetText, so a font path goes through a font object of the frame's own. +function pfUIScrollingEditBoxMixin:SetFont(font, size, flags) + if not self.font then + self.font = CreateFont(self:GetName() .. "Font") + self:GetEditBox().fontName = self.font + end + self.font:SetFont(font, size, flags) + self:SetFontObject(self.font) +end + function pfUI.api.CreateScrollFrame(name, parent) local f = CreateFrame("ScrollFrame", name, parent) diff --git a/api/ui-widgets.xml b/api/ui-widgets.xml index 0d7b3940..a9a02407 100644 --- a/api/ui-widgets.xml +++ b/api/ui-widgets.xml @@ -28,4 +28,26 @@