Manual test used here:
abc
{"p1":{"y":72,"x":82},"mode":"line","p2":{"y":29,"x":169}}
def
{"p1":{"y":36,"x":56},"mode":"line","p2":{"y":59,"x":163}}
ghi jkl
Hitting page-down moves the cursor from abc to ghi. The 'ghi' line should be fully visible on screen.
242L3OQXTU2TCAINRJXQEEDSXQXM7Y7USUPBK37ZNM3A7V5TUDSAC A2TQYJ6JZJF2T47C26H2IRSR6O67BP6VHY5PV7GTFG4IZNQQBJVQC DLQMM2656JHXX3ONOEM6UIOXKFJFT5QT7RHWK7YS2W77PVZWHRSAC HYEAFRZ2UEKDYTAE2GDQLHEJBPQASP2NDLMXB7F6MTVK2BKOXKEAC BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC XNFTJHC4QSHNSIWNN7K6QZEZ37GTQYKHS4EPNSVPQCUSWREROGIQC FS2ITYYHBLFT66YUC3ENPFYI2HOYHOVEPQIN7NQR6KF5MEK4NKZAC function Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary()while Cursor_line <= #Lines doif Lines[Cursor_line].mode == 'text' thenbreakendCursor_line = Cursor_line + 1end-- hack: insert a text line at bottom of file if necessaryif Cursor_line > #Lines thenassert(Cursor_line == #Lines+1)table.insert(Lines, {mode='text', data=''})endif Cursor_line > Screen_bottom_line thenScreen_top_line = Cursor_lineText.scroll_up_while_cursor_on_screen()endendfunction Text.scroll_up_while_cursor_on_screen()local y = Screen_height - 15*Zoom -- for Cursor_linewhile true doif Screen_top_line == 1 then break endy = y - 15*Zoomif Lines[Screen_top_line].mode == 'drawing' theny = y - Drawing.pixels(Lines[Screen_top_line].h)endif y < 15*Zoom thenbreakendScreen_top_line = Screen_top_line - 1endend
* The text cursor will always stay on the screen. This can have some strangeimplications:* A long series of drawings will get silently skipped when you hitpage-down, until a line of text can be showed on screen.* If there's no line of text at the bottom of the file, one will becreated.So far this app isn't really designed for all-drawing files. I'm really justtargeting mostly-text files with a few drawings mixed in.