room specific text: actually render empty lines

This commit is contained in:
Franzi 2023-12-24 12:01:28 +01:00
parent 5f98771957
commit d908c361f8

View file

@ -493,23 +493,27 @@ local function view_info(starts, ends, config, x1, y1, x2, y2)
local y = 0 local y = 0
for line in string.gmatch(info_text.."\n", "([^\n]*)\n") do for line in string.gmatch(info_text.."\n", "([^\n]*)\n") do
local lines = wrap( if line ~= "" then
line, local lines = wrap(
font_text, font_size, a.width line,
) font_text, font_size, a.width
)
for idx = 1, #lines do for idx = 1, #lines do
local x = 0 local x = 0
local w = font_text:width(lines[idx], font_size) local w = font_text:width(lines[idx], font_size)
if align == "right" then if align == "right" then
x = a.width - w x = a.width - w
elseif align == "center" then elseif align == "center" then
x = (a.width - w) / 2 x = (a.width - w) / 2
end
text(font_text, x, y, lines[idx], font_size, rgba(default_color,.8))
y = y + font_size
end end
else
text(font_text, x, y, lines[idx], font_size, rgba(default_color,.8)) y = y + font_size*0.5
y = y + font_size
end end
end end