Commit 8d8676f1 authored by Robin Schoonover's avatar Robin Schoonover

Detect automatically whether we need a new NL or not when appending to a font string.

parent bacdb64b
Pipeline #224 passed with stage
......@@ -40,7 +40,7 @@ end
do
local tmp = {}
local function textAppendID(self, fs, div, ...)
local function textAppendID(self, fs, ...)
local line = self:IDLine(...)
local orig = fs:GetText()
if line == fs._alltheid and orig ~= nil and strfind(orig, line) then
......@@ -49,7 +49,9 @@ do
wipe(tmp)
tinsert(tmp, orig)
tinsert(tmp, div)
if strsub(orig, -1, -1) ~= "\n" then
tinsert(tmp, "\n")
end
tinsert(tmp, line)
fs:SetText(table.concat(tmp, ""))
......@@ -57,11 +59,7 @@ do
end
function addon:TextAppendID(fs, ...)
textAppendID(self, fs, "\n", ...)
end
function addon:TextAppendID_NoNL(fs, ...)
textAppendID(self, fs, "", ...)
textAppendID(self, fs, ...)
end
end
......
......@@ -43,7 +43,7 @@ OnAddOnLoaded("Blizzard_Collections", function()
hooksecurefunc("MountJournal_UpdateMountDisplay", function()
local spellID = MountJournal.MountDisplay.lastDisplayed
if spellID then
addon:TextAppendID_NoNL(MountJournal.MountDisplay.InfoButton.Lore, "Spell", spellID)
addon:TextAppendID(MountJournal.MountDisplay.InfoButton.Lore, "Spell", spellID)
end
end)
end)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment