From 1e5c44d85bf695bb0ce6dde3816b650b9697e9b0 Mon Sep 17 00:00:00 2001 From: Chris Johnsen Date: Thu, 13 Aug 2026 04:09:55 -0500 Subject: [PATCH] TextAreaContent: remove COLOR_RESET uses with Pen COLOR_RESET should not be used with Pen. The first use looks like it could be a "restore Pen before ending" kind of action; but that should be unnecessary. - The only other drawing done after this in this function is debug-only drawing that sets its own colors. - Any subsequently rendered Views should fully establish their own Pen settings before drawing. A view's `onRenderBody`'s Painter (`dc`, here) *is* normally reused (primarily for the clipping rectangle?) with the subview's `onRenderFrame`, but it would be terribly fragile for a subview to rely on the Pen state left by its parent view (or earlier-rendered sibling views's frame). - TextAreaContent does not have any subviews. The second use is only used when `self.debug` is active, the background color is probably unimportant; use Pen's default background color: black. --- library/lua/gui/widgets/text_area/text_area_content.lua | 4 +--- 1 file changed, 1 insertion(+), 3 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 cd35f751ee..5bda84db26 100644 --- a/library/lua/gui/widgets/text_area/text_area_content.lua +++ b/library/lua/gui/widgets/text_area/text_area_content.lua @@ -288,8 +288,6 @@ function TextAreaContent:onRenderBody(dc) dc:seek(0, to_y - 1) :string(line) end - - dc:pen({bg=COLOR_RESET}, self.text_pen) end if self.debug then @@ -313,7 +311,7 @@ function TextAreaContent:onRenderBody(dc) self.sel_end ) or '' - dc:pen({fg=COLOR_LIGHTRED, bg=COLOR_RESET}) + dc:pen({fg=COLOR_LIGHTRED}) :seek(0, self.parent_view.frame_body.height + self.render_start_line_y - 2) :string(debug_msg) :seek(0, self.parent_view.frame_body.height + self.render_start_line_y - 3)