From 98349028eb121a8e825962fca139be3f64f86bdb Mon Sep 17 00:00:00 2001 From: Peter Nerlich Date: Tue, 17 Nov 2020 23:46:40 +0100 Subject: [PATCH] if a words fits the screen width exactly, don't put it on the next line --- lcd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lcd.lua b/lcd.lua index 8f0dd2b..5ba0046 100644 --- a/lcd.lua +++ b/lcd.lua @@ -35,7 +35,7 @@ local create_lines = function(text) local line_num = 1 local tab = {} for word in string.gmatch(text, "%S*") do - if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then + if (string.len(line) and string.len(line)+1) + string.len(word) <= LINE_LENGTH and word ~= "|" then if line ~= "" then line = line.." "..word else