fixed bug with single word strings in strwrap

This commit is contained in:
Mikayla Fischler 2022-06-18 02:15:03 -04:00
parent e4b7f807fe
commit 5a3897572d

View File

@ -83,7 +83,13 @@ function util.strwrap(str, limit)
local lines = {}
local ln_start = 1
lines[1] = string.sub(str, 1, str:find("([%-%s]+)") - 1)
local first_break = str:find("([%-%s]+)")
if first_break ~= nil then
lines[1] = string.sub(str, 1, first_break - 1)
else
lines[1] = str
end
---@diagnostic disable-next-line: discard-returns
str:gsub("(%s+)()(%S+)()",