From 135fc0b436f2402533d364c88fd75abba5ed1722 Mon Sep 17 00:00:00 2001 From: Ethan Shaughnessy Date: Sat, 22 Feb 2014 14:48:49 -0700 Subject: [PATCH] Parse new lines in text objects correctly --- objects/text.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/objects/text.lua b/objects/text.lua index 32f376f..fff1210 100644 --- a/objects/text.lua +++ b/objects/text.lua @@ -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 \ No newline at end of file +end