Skip to content

Commit

Permalink
Fix repeated numbers sometimes showing on gossip frames (fixes #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Numynum committed Jan 6, 2025
1 parent e72c7cb commit 23d13fd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ function DialogKey:OnGossipFrameUpdate(GossipFrame)
end
if tag then
if self.db.numKeysForGossip then
local newText = (n % 10) .. ". " .. data.info[tag]
local oldText = data.info[tag]
local newText = (n % 10) .. ". " .. (oldText:match("^%d. (.+)$") or oldText)
if self.db.riskyNumKeysForGossip then
data.info[tag] = newText -- this may not be safe, but it looks like the only somewhat reliable way to ensure the scrollbar is enabled when needed
end
Expand Down Expand Up @@ -574,7 +575,9 @@ function DialogKey:EnumerateGossips()
for i, frame in ipairs(self.frames) do
if not checkQuestsToHandle or questsToHandle[i] then
if n > 10 then break end
frame:SetText((n % 10) .. ". " .. frame:GetText())
local oldText = frame:GetText()
local newText = (n % 10) .. ". " .. (oldText:match("^%d. (.+)$") or oldText)
frame:SetText(newText)

-- Make the button taller if the text inside is wrapped to multiple lines
frame:SetHeight(frame:GetFontString():GetHeight() + 2)
Expand Down

0 comments on commit 23d13fd

Please sign in to comment.