split line on ` | ` even when it fits on screen

This commit is contained in:
Peter Nerlich 2020-11-12 17:15:42 +01:00 committed by GitHub
parent cb4135a7a7
commit f5ff984427
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -35,7 +35,9 @@ local create_lines = function(text)
local line_num = 1
local tab = {}
if #text <= LINE_LENGTH then
line = text
for line in string.gmatch(text, " | ") do
table.insert(tab, line)
end
else
for word in string.gmatch(text, "%S+") do
if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then