Still not perfect. Pressing ctrl+down can sometimes cause the cursor node to go too far left or right. I'm only checking the direction of movement so far.
O5F2HG2RYJ4L623VRQBXXJHTMTEAO3ZSUJYY3L7ECVD63TYVKO6AC on.keychord_press = function(chord, key)if chord == 'C-=' then-- zoom inViewport.zoom = Viewport.zoom+0.1B()elseif chord == 'C--' then-- zoom outViewport.zoom = Viewport.zoom-0.1B()elseif chord == 'C-0' then-- reset zoomViewport.zoom = 1.0B()elseif chord == 'C-up' thenif Cursor_node.in_reply_to_id thenCursor_node = Nodes[Cursor_node.in_reply_to_id]if Cursor_node.surface_node.y < Viewport.y thenViewport.y = Cursor_node.surface_node.y - 50B()endendelseif chord == 'C-down' thenif Cursor_node.children and #Cursor_node.children > 0 thenCursor_node = Nodes[Cursor_node.children[1]]local snode = Cursor_node.surface_nodelocal limit = snode.y + box_height(snode)if Viewport.y < limit - App.screen.height/Viewport.zoom thenViewport.y = limit - (App.screen.height-50)/Viewport.zoomB()endendelseif chord == 'C-left' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx > 1 thenCursor_node = Nodes[parent.children[idx-1]]if Cursor_node.surface_node.x < Viewport.x thenViewport.x = Cursor_node.surface_node.x - 50B()endendendendelseif chord == 'C-right' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx < #parent.children thenCursor_node = Nodes[parent.children[idx+1]]local snode = Cursor_node.surface_nodelocal limit = snode.x + 600if Viewport.x < limit - App.screen.width/Viewport.zoom thenViewport.x = limit - (App.screen.width-50)/Viewport.zoomB()endendendendendend
{"on.draw":632,"schema1_of_y":366,"vx":5,"Viewport":303,"on.initialize":446,"y_of_schema1":364,"A":582,"initialize_editor":338,"dehtml":456,"on.mouse_release":586,"box_height":345,"on.update":368,"render_thread_to_surface":626,"on.code_change":578,"Nodes":593,"line_height":365,"load_from_iterator":463,"split_lines":469,"to_node":611,"to_text":180,"scale":7,"fw_parent":641,"Input_filename":436,"add_node":590,"font":353,"Cursor_node":172,"B":379,"ntracks":600,"compute_ntracks":598,"on":1,"vy":8,"add_edge":575,"render_node_and_descendants":633,"on.text_input":587,"update_editor_box":430,"on.mouse_press":618,"on.keychord_press":642,"fw_app":"mastodon-unfurl","add_thick_line":400,"Surface":588,"copy_shape":396,"compute_layout":619}
on.keychord_press = function(chord, key)if chord == 'C-=' then-- zoom inViewport.zoom = Viewport.zoom+0.1B()elseif chord == 'C--' then-- zoom outViewport.zoom = Viewport.zoom-0.1B()elseif chord == 'C-0' then-- reset zoomViewport.zoom = 1.0B()elseif chord == 'C-up' thenif Cursor_node.in_reply_to_id thenCursor_node = Nodes[Cursor_node.in_reply_to_id]if Cursor_node.surface_node.y < Viewport.y thenViewport.y = Cursor_node.surface_node.y - 50B()endendelseif chord == 'C-down' thenif Cursor_node.children and #Cursor_node.children > 0 thenCursor_node = Nodes[Cursor_node.children[1]]local snode = Cursor_node.surface_nodelocal limit = snode.y + box_height(snode)if Viewport.y < limit - App.screen.height/Viewport.zoom thenViewport.y = limit - (App.screen.height-50)/Viewport.zoomB()endendelseif chord == 'C-left' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx > 1 thenCursor_node = Nodes[parent.children[idx-1]]if Cursor_node.surface_node.x < Viewport.x thenViewport.x = Cursor_node.surface_node.x - 50B()endendendendelseif chord == 'C-right' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx < #parent.children thenCursor_node = Nodes[parent.children[idx+1]]endendendendend
{"on.draw":632,"schema1_of_y":366,"vx":5,"Viewport":303,"on.initialize":446,"y_of_schema1":364,"A":582,"initialize_editor":338,"dehtml":456,"on.mouse_release":586,"box_height":345,"on.update":368,"render_thread_to_surface":626,"on.code_change":578,"Nodes":593,"line_height":365,"load_from_iterator":463,"split_lines":469,"to_node":611,"to_text":180,"scale":7,"fw_parent":640,"Input_filename":436,"add_node":590,"font":353,"Cursor_node":172,"B":379,"ntracks":600,"compute_ntracks":598,"on":1,"vy":8,"add_edge":575,"render_node_and_descendants":633,"on.text_input":587,"update_editor_box":430,"on.mouse_press":618,"on.keychord_press":641,"fw_app":"mastodon-unfurl","add_thick_line":400,"Surface":588,"copy_shape":396,"compute_layout":619}
on.keychord_press = function(chord, key)if chord == 'C-=' then-- zoom inViewport.zoom = Viewport.zoom+0.1B()elseif chord == 'C--' then-- zoom outViewport.zoom = Viewport.zoom-0.1B()elseif chord == 'C-0' then-- reset zoomViewport.zoom = 1.0B()elseif chord == 'C-up' thenif Cursor_node.in_reply_to_id thenCursor_node = Nodes[Cursor_node.in_reply_to_id]if Cursor_node.surface_node.y < Viewport.y thenViewport.y = Cursor_node.surface_node.y - 50B()endendelseif chord == 'C-down' thenif Cursor_node.children and #Cursor_node.children > 0 thenCursor_node = Nodes[Cursor_node.children[1]]local snode = Cursor_node.surface_nodelocal limit = snode.y + box_height(snode)if Viewport.y < limit - App.screen.height/Viewport.zoom thenViewport.y = limit - (App.screen.height-50)/Viewport.zoomB()endendelseif chord == 'C-left' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx > 1 thenCursor_node = Nodes[parent.children[idx-1]]endendendelseif chord == 'C-right' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx < #parent.children thenCursor_node = Nodes[parent.children[idx+1]]endendendendend
{"on.draw":632,"schema1_of_y":366,"vx":5,"Viewport":303,"on.initialize":446,"y_of_schema1":364,"A":582,"initialize_editor":338,"dehtml":456,"on.mouse_release":586,"box_height":345,"on.update":368,"render_thread_to_surface":626,"on.code_change":578,"Nodes":593,"line_height":365,"load_from_iterator":463,"split_lines":469,"to_node":611,"to_text":180,"scale":7,"fw_parent":639,"Input_filename":436,"add_node":590,"font":353,"Cursor_node":172,"B":379,"ntracks":600,"compute_ntracks":598,"on":1,"vy":8,"add_edge":575,"render_node_and_descendants":633,"on.text_input":587,"update_editor_box":430,"on.mouse_press":618,"on.keychord_press":640,"fw_app":"mastodon-unfurl","add_thick_line":400,"Surface":588,"copy_shape":396,"compute_layout":619}
on.keychord_press = function(chord, key)if chord == 'C-=' then-- zoom inViewport.zoom = Viewport.zoom+0.1B()elseif chord == 'C--' then-- zoom outViewport.zoom = Viewport.zoom-0.1B()elseif chord == 'C-0' then-- reset zoomViewport.zoom = 1.0B()elseif chord == 'C-up' thenif Cursor_node.in_reply_to_id thenCursor_node = Nodes[Cursor_node.in_reply_to_id]if Cursor_node.surface_node.y < Viewport.y thenViewport.y = Cursor_node.surface_node.y - 50B()endendelseif chord == 'C-down' thenif Cursor_node.children and #Cursor_node.children > 0 thenCursor_node = Nodes[Cursor_node.children[1]]local snode = Cursor_node.surface_nodelocal limit = snode.y + box_height(snode)if Viewport.y < limit - App.screen.height/Viewport.zoom thenViewport.y = limit - (App.screen.height-50)/Viewport.zoomendendelseif chord == 'C-left' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx > 1 thenCursor_node = Nodes[parent.children[idx-1]]endendendelseif chord == 'C-right' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx < #parent.children thenCursor_node = Nodes[parent.children[idx+1]]endendendendend
{"on.draw":632,"schema1_of_y":366,"vx":5,"Viewport":303,"on.initialize":446,"y_of_schema1":364,"A":582,"initialize_editor":338,"dehtml":456,"on.mouse_release":586,"box_height":345,"on.update":368,"render_thread_to_surface":626,"on.code_change":578,"Nodes":593,"line_height":365,"load_from_iterator":463,"split_lines":469,"to_node":611,"to_text":180,"scale":7,"fw_parent":638,"Input_filename":436,"add_node":590,"font":353,"Cursor_node":172,"B":379,"ntracks":600,"compute_ntracks":598,"on":1,"vy":8,"add_edge":575,"render_node_and_descendants":633,"on.text_input":587,"update_editor_box":430,"on.mouse_press":618,"on.keychord_press":639,"fw_app":"mastodon-unfurl","add_thick_line":400,"Surface":588,"copy_shape":396,"compute_layout":619}
on.keychord_press = function(chord, key)if chord == 'C-=' then-- zoom inViewport.zoom = Viewport.zoom+0.1B()elseif chord == 'C--' then-- zoom outViewport.zoom = Viewport.zoom-0.1B()elseif chord == 'C-0' then-- reset zoomViewport.zoom = 1.0B()elseif chord == 'C-up' thenif Cursor_node.in_reply_to_id thenCursor_node = Nodes[Cursor_node.in_reply_to_id]if Cursor_node.surface_node.y < Viewport.y thenViewport.y = Cursor_node.surface_node.y - 50B()endendelseif chord == 'C-down' thenif Cursor_node.children and #Cursor_node.children > 0 thenCursor_node = Nodes[Cursor_node.children[1]]endelseif chord == 'C-left' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx > 1 thenCursor_node = Nodes[parent.children[idx-1]]endendendelseif chord == 'C-right' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx < #parent.children thenCursor_node = Nodes[parent.children[idx+1]]endendendendend
{"on.draw":632,"schema1_of_y":366,"vx":5,"Viewport":303,"on.initialize":446,"y_of_schema1":364,"A":582,"initialize_editor":338,"dehtml":456,"on.mouse_release":586,"box_height":345,"on.update":368,"render_thread_to_surface":626,"on.code_change":578,"Nodes":593,"line_height":365,"load_from_iterator":463,"split_lines":469,"to_node":611,"to_text":180,"scale":7,"fw_parent":637,"Input_filename":436,"add_node":590,"font":353,"Cursor_node":172,"B":379,"ntracks":600,"compute_ntracks":598,"on":1,"vy":8,"add_edge":575,"render_node_and_descendants":633,"on.text_input":587,"update_editor_box":430,"on.mouse_press":618,"on.keychord_press":638,"fw_app":"mastodon-unfurl","add_thick_line":400,"Surface":588,"copy_shape":396,"compute_layout":619}
on.keychord_press = function(chord, key)if chord == 'C-=' then-- zoom inViewport.zoom = Viewport.zoom+0.1B()elseif chord == 'C--' then-- zoom outViewport.zoom = Viewport.zoom-0.1B()elseif chord == 'C-0' then-- reset zoomViewport.zoom = 1.0B()elseif chord == 'C-up' thenif Cursor_node.in_reply_to_id thenCursor_node = Nodes[Cursor_node.in_reply_to_id]print(Cursor_node.surface_node.y, Viewport.y)if Cursor_node.surface_node.y < Viewport.y thenViewport.y = Cursor_node.surface_node.y - 50endendelseif chord == 'C-down' thenif Cursor_node.children and #Cursor_node.children > 0 thenCursor_node = Nodes[Cursor_node.children[1]]endelseif chord == 'C-left' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx > 1 thenCursor_node = Nodes[parent.children[idx-1]]endendendelseif chord == 'C-right' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx < #parent.children thenCursor_node = Nodes[parent.children[idx+1]]endendendendend
{"on.draw":632,"schema1_of_y":366,"vx":5,"Viewport":303,"on.initialize":446,"y_of_schema1":364,"A":582,"initialize_editor":338,"dehtml":456,"on.mouse_release":586,"box_height":345,"on.update":368,"render_thread_to_surface":626,"on.code_change":578,"Nodes":593,"line_height":365,"load_from_iterator":463,"split_lines":469,"to_node":611,"to_text":180,"scale":7,"fw_parent":636,"Input_filename":436,"add_node":590,"font":353,"Cursor_node":172,"B":379,"ntracks":600,"compute_ntracks":598,"on":1,"vy":8,"add_edge":575,"render_node_and_descendants":633,"on.text_input":587,"update_editor_box":430,"on.mouse_press":618,"on.keychord_press":637,"fw_app":"mastodon-unfurl","add_thick_line":400,"Surface":588,"copy_shape":396,"compute_layout":619}
on.keychord_press = function(chord, key)if chord == 'C-=' then-- zoom inViewport.zoom = Viewport.zoom+0.1B()elseif chord == 'C--' then-- zoom outViewport.zoom = Viewport.zoom-0.1B()elseif chord == 'C-0' then-- reset zoomViewport.zoom = 1.0B()elseif chord == 'C-up' thenif Cursor_node.in_reply_to_id thenCursor_node = Nodes[Cursor_node.in_reply_to_id]for k in pairs(Cursor_node) doprint(k)endprint(Cursor_node.y, Viewport.y)if Cursor_node.y < Viewport.y thenViewport.y = Cursor_node.y - 50endendelseif chord == 'C-down' thenif Cursor_node.children and #Cursor_node.children > 0 thenCursor_node = Nodes[Cursor_node.children[1]]endelseif chord == 'C-left' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx > 1 thenCursor_node = Nodes[parent.children[idx-1]]endendendelseif chord == 'C-right' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx < #parent.children thenCursor_node = Nodes[parent.children[idx+1]]endendendendend
{"on.draw":632,"schema1_of_y":366,"vx":5,"Viewport":303,"on.initialize":446,"y_of_schema1":364,"A":582,"initialize_editor":338,"dehtml":456,"on.mouse_release":586,"box_height":345,"on.update":368,"render_thread_to_surface":626,"on.code_change":578,"Nodes":593,"line_height":365,"load_from_iterator":463,"split_lines":469,"to_node":611,"to_text":180,"scale":7,"fw_parent":635,"Input_filename":436,"add_node":590,"font":353,"Cursor_node":172,"B":379,"ntracks":600,"compute_ntracks":598,"on":1,"vy":8,"add_edge":575,"render_node_and_descendants":633,"on.text_input":587,"update_editor_box":430,"on.mouse_press":618,"on.keychord_press":636,"fw_app":"mastodon-unfurl","add_thick_line":400,"Surface":588,"copy_shape":396,"compute_layout":619}
on.keychord_press = function(chord, key)if chord == 'C-=' then-- zoom inViewport.zoom = Viewport.zoom+0.1B()elseif chord == 'C--' then-- zoom outViewport.zoom = Viewport.zoom-0.1B()elseif chord == 'C-0' then-- reset zoomViewport.zoom = 1.0B()elseif chord == 'C-up' thenif Cursor_node.in_reply_to_id thenCursor_node = Nodes[Cursor_node.in_reply_to_id]for k in pairs(Cursor_node) doprint(k)endprint(Cursor_node.y, Viewport.y)if Cursor_node.y < Viewport.y thenViewport.y = Cursor_node.y - 50endendelseif chord == 'C-down' thenif Cursor_node.children and #Cursor_node.children > 0 thenCursor_node = Nodes[Cursor_node.children[1]]endelseif chord == 'C-left' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx > 1 thenCursor_node = Nodes[parent.children[idx-1]]endendendelseif chord == 'C-right' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx < #parent.children thenCursor_node = Nodes[parent.children[idx+1]]endendendendend
{"on.draw":632,"schema1_of_y":366,"vx":5,"Viewport":303,"on.initialize":446,"y_of_schema1":364,"A":582,"initialize_editor":338,"dehtml":456,"on.mouse_release":586,"box_height":345,"on.update":368,"render_thread_to_surface":626,"on.code_change":578,"Nodes":593,"line_height":365,"load_from_iterator":463,"split_lines":469,"to_node":611,"to_text":180,"scale":7,"fw_parent":634,"Input_filename":436,"add_node":590,"font":353,"Cursor_node":172,"B":379,"ntracks":600,"compute_ntracks":598,"on":1,"vy":8,"add_edge":575,"render_node_and_descendants":633,"on.text_input":587,"update_editor_box":430,"on.mouse_press":618,"on.keychord_press":635,"fw_app":"mastodon-unfurl","add_thick_line":400,"Surface":588,"copy_shape":396,"compute_layout":619}
on.keychord_press = function(chord, key)if chord == 'C-=' then-- zoom inViewport.zoom = Viewport.zoom+0.1B()elseif chord == 'C--' then-- zoom outViewport.zoom = Viewport.zoom-0.1B()elseif chord == 'C-0' then-- reset zoomViewport.zoom = 1.0B()elseif chord == 'C-up' thenif Cursor_node.in_reply_to_id thenCursor_node = Nodes[Cursor_node.in_reply_to_id]print(Cursor_node.y, Viewport.y)if Cursor_node.y < Viewport.y thenViewport.y = Cursor_node.y - 50endendelseif chord == 'C-down' thenif Cursor_node.children and #Cursor_node.children > 0 thenCursor_node = Nodes[Cursor_node.children[1]]endelseif chord == 'C-left' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx > 1 thenCursor_node = Nodes[parent.children[idx-1]]endendendelseif chord == 'C-right' thenif Cursor_node.in_reply_to_id thenlocal parent = Nodes[Cursor_node.in_reply_to_id]assert(parent.children)if #parent.children > 1 thenlocal idx = array.find(parent.children, Cursor_node.id)if idx < #parent.children thenCursor_node = Nodes[parent.children[idx+1]]endendendendend
{"on.draw":632,"schema1_of_y":366,"vx":5,"Viewport":303,"on.initialize":446,"y_of_schema1":364,"A":582,"initialize_editor":338,"dehtml":456,"on.mouse_release":586,"box_height":345,"on.update":368,"render_thread_to_surface":626,"on.code_change":578,"Nodes":593,"line_height":365,"load_from_iterator":463,"split_lines":469,"to_node":611,"to_text":180,"scale":7,"fw_parent":633,"Input_filename":436,"add_node":590,"font":353,"Cursor_node":172,"B":379,"ntracks":600,"compute_ntracks":598,"on":1,"vy":8,"add_edge":575,"render_node_and_descendants":633,"on.text_input":587,"update_editor_box":430,"on.mouse_press":618,"on.keychord_press":634,"fw_app":"mastodon-unfurl","add_thick_line":400,"Surface":588,"copy_shape":396,"compute_layout":619}