From 54c43e07ccbec9c714bdd6452aeb3becc6d88968 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 1 Nov 2016 14:57:15 +0100 Subject: Fix final line of text widget being lost --- init.lua | 10 ++++++---- 1 file 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 -- cgit v1.2.3