Skip to content

Commit 23d13fd

Browse files
committed
Fix repeated numbers sometimes showing on gossip frames (fixes #6)
1 parent e72c7cb commit 23d13fd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

main.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ function DialogKey:OnGossipFrameUpdate(GossipFrame)
193193
end
194194
if tag then
195195
if self.db.numKeysForGossip then
196-
local newText = (n % 10) .. ". " .. data.info[tag]
196+
local oldText = data.info[tag]
197+
local newText = (n % 10) .. ". " .. (oldText:match("^%d. (.+)$") or oldText)
197198
if self.db.riskyNumKeysForGossip then
198199
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
199200
end
@@ -574,7 +575,9 @@ function DialogKey:EnumerateGossips()
574575
for i, frame in ipairs(self.frames) do
575576
if not checkQuestsToHandle or questsToHandle[i] then
576577
if n > 10 then break end
577-
frame:SetText((n % 10) .. ". " .. frame:GetText())
578+
local oldText = frame:GetText()
579+
local newText = (n % 10) .. ". " .. (oldText:match("^%d. (.+)$") or oldText)
580+
frame:SetText(newText)
578581

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

0 commit comments

Comments
 (0)