Let's see if we can do without.
EAHBVX4JVOMSJCMHLOMB6GWTWQNMKVXMPONA7L4KDVH3YFX7EZKAC local cursor_sy = up_edge_sy(Cursor_pane.col, Cursor_pane.row) + y_of_schema1(pane, pane.cursor1)if not eq(old_top, pane.screen_top1) and eq(old_top, {line=1, pos=1}) and pane.top > Header_height and cursor_sy - Display_settings.y > App.screen.height - Header_height - Line_height then-- pan the surface instead of scrolling within the panepane.screen_top1 = old_topbring_cursor_of_cursor_pane_in_view('down')Surface.cursor_on_screen_check = true -- cursor was on screen before keystroke, so it should remain on screen afterreturnendif not eq(old_top, pane.screen_top1) thenDisplay_settings.y = up_edge_sy(Cursor_pane.col, Cursor_pane.row) + y_of_schema1(pane, pane.screen_top1)Surface.cursor_on_screen_check = true -- cursor was on screen before keystroke, so it should remain on screen afterend
if eq(old_top, pane.screen_top1) then return endDisplay_settings.y = up_edge_sy(Cursor_pane.col, Cursor_pane.row) + y_of_schema1(pane, pane.screen_top1)Surface.cursor_on_screen_check = true -- cursor was on screen before keystroke, so it should remain on screen after