Scenario:
Before this commit, the rendering got mangled when running A with Viewport.zoom != 1.
V2DSGKQSRTM72CG7TJSBYB3XOGVYNGWIUWKMW5GMJQJRAIF2WLZQC
{"compute_ntracks":598,"render_thread_to_surface":655,"on.initialize":665,"A":582,"dehtml":663,"B":666,"fw_app":"mastodon-unfurl","scale":7,"compute_layout":619,"add_edge":575,"vx":5,"load_from_iterator":463,"vy":8,"add_thick_line":400,"Surface":588,"copy_shape":396,"on.draw":632,"Cursor_node":172,"add_node":650,"on.text_input":587,"on.mouse_press":618,"render_node_and_descendants":646,"on.mouse_release":586,"update_editor_box":430,"on.update":368,"font":353,"on.keychord_press":644,"fw_parent":666,"Viewport":303,"on.code_change":578,"on":1,"split_lines":469,"Input_filename":436,"box_height":667,"line_height":365,"schema1_of_y":366,"header":651,"y_of_schema1":364,"Root":654,"initialize_editor":338,"to_node":611,"ensure_cursor_node_within_viewport":643,"Nodes":593,"ntracks":600,"to_text":180}
box_height = function(node)
-- return the height of a node. The result is scaled.
local y = 0
for i=1,#node.editor.lines do
local line = node.editor.lines[i]
if node.editor.line_cache[i] == nil then
node.editor.line_cache[i] = {}
end
node.editor.line_cache[i].fragments = nil
node.editor.line_cache[i].screen_line_starting_pos = nil
Text.compute_fragments(node.editor, i)
Text.populate_screen_line_starting_pos(node.editor, i)
y = y + node.editor.line_height*#node.editor.line_cache[i].screen_line_starting_pos
Text.clear_screen_line_cache(node.editor, i)
end
-- font size never changes in this app
return y/Viewport.zoom
end