From d908c361f87638a3fe4d0c29f1a7f24e7a3d8e41 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sun, 24 Dec 2023 12:01:28 +0100 Subject: [PATCH] room specific text: actually render empty lines --- tile.lua | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/tile.lua b/tile.lua index 9f83341..06fa03f 100644 --- a/tile.lua +++ b/tile.lua @@ -493,23 +493,27 @@ local function view_info(starts, ends, config, x1, y1, x2, y2) local y = 0 for line in string.gmatch(info_text.."\n", "([^\n]*)\n") do - local lines = wrap( - line, - font_text, font_size, a.width - ) + if line ~= "" then + local lines = wrap( + line, + font_text, font_size, a.width + ) - for idx = 1, #lines do - local x = 0 - local w = font_text:width(lines[idx], font_size) + for idx = 1, #lines do + local x = 0 + local w = font_text:width(lines[idx], font_size) - if align == "right" then - x = a.width - w - elseif align == "center" then - x = (a.width - w) / 2 + if align == "right" then + x = a.width - w + elseif align == "center" then + x = (a.width - w) / 2 + end + + text(font_text, x, y, lines[idx], font_size, rgba(default_color,.8)) + y = y + font_size end - - text(font_text, x, y, lines[idx], font_size, rgba(default_color,.8)) - y = y + font_size + else + y = y + font_size*0.5 end end