summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-11-01 14:57:15 +0100
committerWuzzy <almikes@aol.com>2016-11-01 14:57:15 +0100
commit54c43e07ccbec9c714bdd6452aeb3becc6d88968 (patch)
treeadf1ac54c8ec6923e7b3ffb0babf6925c3f31a7f
parenta8bc9b83adf5bd2971c12da26605c5dc38af8385 (diff)
Fix final line of text widget being lost
-rw-r--r--init.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index a048df3..608b49c 100644
--- a/init.lua
+++ b/init.lua
@@ -362,10 +362,12 @@ 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
- out = out .. "\n"
+ 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