Fix final line of text widget being lost

This commit is contained in:
Wuzzy 2016-11-01 14:57:15 +01:00
parent a8bc9b83ad
commit 54c43e07cc

View File

@ -362,11 +362,13 @@ end
-- Inserts automatic line breaks into an entire text and preserves existing newlines
local linebreaker = function(text, linelength)
local out = ""
for s in string.gmatch(text, "([^\n]*)\n") do
s = linebreaker_single(s, linelength)
out = out .. s
for s in string.gmatch(text, "([^\n]*)") do
local l = linebreaker_single(s, linelength)
out = out .. l
if(string.len(l) == 0) then
out = out .. "\n"
end
end
-- Remove last newline
if string.len(out) >= 1 then
out = string.sub(out, 1, string.len(out) - 1)