Small bugfix
supporting \n for richtext wrapping
This commit is contained in:
@@ -167,7 +167,9 @@ local function wrapRichText(text, width)
|
|||||||
elseif entry.bgColor then
|
elseif entry.bgColor then
|
||||||
currentBgColor = entry.bgColor
|
currentBgColor = entry.bgColor
|
||||||
else
|
else
|
||||||
local words = splitString(entry.text, " ")
|
local paragraphs = splitString(entry.text, "\n")
|
||||||
|
for p, paragraph in ipairs(paragraphs) do
|
||||||
|
local words = splitString(paragraph, " ")
|
||||||
|
|
||||||
for i, word in ipairs(words) do
|
for i, word in ipairs(words) do
|
||||||
local wordLength = #word
|
local wordLength = #word
|
||||||
@@ -197,6 +199,12 @@ local function wrapRichText(text, width)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if p ~= #paragraphs then
|
||||||
|
x = 1
|
||||||
|
y = y + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if x > width then
|
if x > width then
|
||||||
@@ -211,6 +219,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getTextHorizontalAlign = function(text, width, textAlign, replaceChar)
|
getTextHorizontalAlign = function(text, width, textAlign, replaceChar)
|
||||||
text = sub(text, 1, width)
|
text = sub(text, 1, width)
|
||||||
|
|||||||
Reference in New Issue
Block a user