From 5a2181d55eb860809828d389d774f1e056fe6b1e Mon Sep 17 00:00:00 2001 From: myk002 Date: Wed, 13 Jan 2021 22:02:22 -0800 Subject: [PATCH] don't render overflow text --- library/lua/gui/widgets.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index d9d8d4bf4..29d5aa827 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -234,13 +234,14 @@ end function render_text(obj,dc,x0,y0,pen,dpen,disabled) local width = 0 - -- note that lines outside of the containing frame are not displayed, so - -- we only have to bound the start condition, not the end condition for iline = dc and obj.start_line_num or 1, #obj.text_lines do local x, line = 0, obj.text_lines[iline] if dc then local offset = (obj.start_line_num or 1) - 1 - dc:seek(x+x0,y0+iline-offset-1) + local y = y0 + iline - offset - 1 + -- skip text outside of the containing frame + if y > dc.height - 1 then break end + dc:seek(x+x0, y) end for _,token in ipairs(line) do token.line = iline