feat(gui): lange tekstrækker ombrydes over flere linjer i stedet for at blive afkortet; markdetaljen viser hele statusteksten (v1.29.4.0)

This commit is contained in:
2026-09-26 16:29:21 +02:00
parent 813ee6d0b9
commit 1b0a2c152b
7 changed files with 47 additions and 4 deletions
+19
View File
@@ -147,3 +147,22 @@ function ADFlowView.joinCounted(names, separator, empty)
end
return table.concat(parts, separator)
end
-- Lang tekst -> linjer på højst maxChars (ombrydes ved mellemrum; indrykning gentages på hver linje,
-- så en indrykket forklaring forbliver indrykket). Ét ord længere end linjen deles ikke.
function ADFlowView.wrapText(text, maxChars)
text = tostring(text or "")
if #text <= maxChars then return {text} end
local indent = string.match(text, "^%s*") or ""
local lines, line = {}, indent
for word in string.gmatch(string.sub(text, #indent + 1), "%S+") do
if line ~= indent and #line + 1 + #word > maxChars then
table.insert(lines, line)
line = indent .. word
else
line = line == indent and (indent .. word) or (line .. " " .. word)
end
end
if line ~= indent then table.insert(lines, line) end
return lines
end