if a words fits the screen width exactly, don't put it on the next line

This commit is contained in:
Peter Nerlich 2020-11-17 23:46:40 +01:00 committed by GitHub
parent 3c0900c115
commit 98349028eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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