From 17c1dc0ec26375575cd7998bb2aa30bff321ddbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Obr=C4=99bski?= Date: Wed, 22 Jan 2025 08:56:31 +0100 Subject: [PATCH] Fix TextArea custom pens handling --- .../gui/widgets/text_area/text_area_content.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/library/lua/gui/widgets/text_area/text_area_content.lua b/library/lua/gui/widgets/text_area/text_area_content.lua index 0791f200d9..97e6fe1c6e 100644 --- a/library/lua/gui/widgets/text_area/text_area_content.lua +++ b/library/lua/gui/widgets/text_area/text_area_content.lua @@ -37,15 +37,15 @@ function TextAreaContent:init() self.cursor = nil self.main_pen = dfhack.pen.parse({ - fg=self.text_pen, bg=COLOR_RESET, bold=true - }) - self.sel_pen = dfhack.pen.parse({ - fg=self.text_pen, - bg=self.pen_selection, - bold=true - }) + }, self.text_pen) + + if type(self.pen_selection) == 'number' then + self.sel_pen = dfhack.pen.parse(self.main_pen, nil, self.pen_selection) + else + self.sel_pen = dfhack.pen.parse(self.pen_selection) + end local TextWrapper = self.one_line_mode and OneLineWrappedText or WrappedText self.wrapped_text = TextWrapper{ @@ -281,7 +281,7 @@ function TextAreaContent:onRenderBody(dc) :string(line) end - dc:pen({fg=self.text_pen, bg=COLOR_RESET}) + dc:pen({bg=COLOR_RESET}, self.text_pen) end if self.debug then