Merge pull request #109 from MCGamer20000/master

Parse new lines in text objects correctly
This commit is contained in:
Kenny Shields 2014-02-24 17:03:58 -05:00
commit a98c82755e

View File

@ -282,10 +282,10 @@ function newobject:SetText(t)
table.insert(self.formattedtext, {font = prevfont, color = prevcolor, linkcolor = prevlinkcolor, linkhovercolor = prevlinkhovercolor, link = link, text = tostring(v)})
elseif dtype == "string" then
if self.ignorenewlines then
v = v:gsub(" \n ", " ")
v = v:gsub("\n", "")
v = v:gsub("\n", " ")
end
v = v:gsub(string.char(9), " ")
v = v:gsub("\n", " \n ")
local parts = loveframes.util.SplitString(v, " ")
for i, j in ipairs(parts) do
table.insert(self.formattedtext, {font = prevfont, color = prevcolor, linkcolor = prevlinkcolor, linkhovercolor = prevlinkhovercolor, link = link, text = j})
@ -778,4 +778,4 @@ function newobject:GetDetectLinks()
return self.detectlinks
end
end