ensure date is rendered properly

This commit is contained in:
takase1121 2021-12-22 09:55:47 +08:00
parent 54f6579e9d
commit 8f06ef9b81
No known key found for this signature in database
GPG Key ID: 60EEFFC68EB3031B
1 changed files with 3 additions and 2 deletions

View File

@ -150,6 +150,8 @@ function LogView:draw()
style.icon_font:get_width(style.log.ERROR.icon),
style.icon_font:get_width(style.log.INFO.icon)
)
local tw = style.font:get_width(os.date())
for _, item, x, y, w, h in self:each_item() do
core.push_clip_rect(x, y, w, h)
x = x + style.padding.x
@ -164,9 +166,8 @@ function LogView:draw()
x = x + style.padding.x
-- timestamps are always 15% of the width
local tw = w * 15 / 100
local time = os.date(nil, item.time)
common.draw_text(style.font, style.dim, time, "center", x, y, tw, lh)
common.draw_text(style.font, style.dim, time, "left", x, y, tw, lh)
x = x + tw + style.padding.x
w = w - (x - self:get_content_offset())