From 61227eeca1a59f13fb228864517f6955526529e1 Mon Sep 17 00:00:00 2001 From: Kelvie Wong Date: Thu, 16 Feb 2023 21:54:44 -0800 Subject: [PATCH] Fix use of pens in render_text If you ever pass in a number to `dc:pen` rather than a pen table, it will assume the old pen's other attributes, such as `bg` and `bold`. To workaround this, we just never pass in a number, and always call `to_pen` aka `dfhack.pen.parse` first. --- library/lua/gui/widgets.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index e0f01701d..142e928d3 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -1139,11 +1139,11 @@ function render_text(obj,dc,x0,y0,pen,dpen,disabled,hpen,hovered) if dc then local tpen = getval(token.pen) - local dcpen = tpen or pen + local dcpen = to_pen(tpen or pen) -- If disabled, figure out which dpen to use if disabled or is_disabled(token) then - dccpen = getval(token.dpen) or tpen or dpen + dcpen = to_pen(getval(token.dpen) or tpen or dpen) if keypen.fg ~= COLOR_BLACK then keypen.bold = false end