don't render overflow text

develop
myk002 2021-01-13 22:02:22 -08:00
parent d4fbf4261f
commit 5a2181d55e
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 4 additions and 3 deletions

@ -234,13 +234,14 @@ end
function render_text(obj,dc,x0,y0,pen,dpen,disabled) function render_text(obj,dc,x0,y0,pen,dpen,disabled)
local width = 0 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 for iline = dc and obj.start_line_num or 1, #obj.text_lines do
local x, line = 0, obj.text_lines[iline] local x, line = 0, obj.text_lines[iline]
if dc then if dc then
local offset = (obj.start_line_num or 1) - 1 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 end
for _,token in ipairs(line) do for _,token in ipairs(line) do
token.line = iline token.line = iline