I just went over all my changes in this vein: git diff 6fe017ba75
(Turns out git diff "does what you want" and excludes changes merged
in from upstream:
https://stackoverflow.com/questions/7488956/git-diff-on-topic-branch-excluding-merge-commits-that-happened-in-the-meantime)
First step: clean up all debug prints. I'm still going to keep unrelated improvements. In particular, the assertion checking for screen going off screen now works, so this bug will be more apparent.
Summary of the problem: Text.snap_cursor_to_bottom_of_screen (which sets screen_top) interacts poorly with plan_draw (which sets Display_settings.y). It's easy to cause 3 misfits:
6LBSEPBJTXIVBYX3AH5FYCQCN66ZRFFO3IVYMDS7IQUGEAZM3MHQC IFGHOCUOIAKC722BNCIRNE2EDMGF77FBTYS57H5UWN6YXOLSZHQQC ZCELTHLQU3DL337ELVAPHLDQ2SFY4ENAQA2STBLLVOLR4PXLKNYQC OPCDU4JRKPTMJXGWCQ3FTYTGQO5CJVSLCOKSDWOFHBFHNQFH4FIQC JFSV6PHC55Z6O4WELHH7PQ22GHUGTG3FFPGSK2E5DA4AXBCMDIFQC Z5HLXU4PJWWJJDBCK52NBD6PIRIA3TAN2BKZB5HBYFGIDBX4F5HAC BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC MXA3RZYKUI4UF2ISY7JEF6VKX6NOPZMZH5SLLCZHRJKFIXXXDPSAC ZPUQSPQPQFVRUIHGLAWW3IDBYODIWDHO62HAC3WWF5TM3CIJGHNQC QBL4YDQ5QC4MZ7RFS4ZSEBPN5WATAJ7UQLUPTXDUMXAMGBGQDOOQC SVJZZDC3K6AKAXHGRNAZKRE2ZXEKJANNLG7LSSUZJARFBL5F7C4AC GO4OXDP4USUBN2UGNY2ZZEUZE3NG52F3T5CZ76H7VQ23Q4CQOSJAC TGHAJBESCIEGWUE2D3FGLNOIAYT4D2IRGZKRXRMTUFW7QZETC7OAC CUIV2LE5D6GUQ4NU7K2TGUVO5CTUXVJDRCZUIV47LXTOUSEPEJHQC HTWAM4NZFOY463TNSKYIM2EWB7QNBGDRRTTGHF5N3Z4TGC7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4OPNBUOGO27DAC UMRNXBPB2VOBLHHWVNFQDF5YYQ3IWYHSGFUTXURKYW4MZLPB33BQC JKAMPNVJHLSYZT5M7GKWGIHTJFIJU3VUJ2AWHLH3ORDUX3UTCF5QC 2L5MEZV344TOZLVY3432RHJFIRVXFD6O3GWLL5O4CV66BGAFTURQC LNUHQOGHIOFGJXNGA3DZLYEASLYYDGLN2I3EDZY5ANASQAHCG3YQC X3F7ECSLGXCH6NBSDIH7LY47I4EG2RR5VFPEMM6ZVDYQIGFID4HQC SPTL7VK47SAGTCGQDCQWMEFC43KWJNWCL76NSYHEVBENHIWKRWNAC GQBUV2XOMEPMTXMPCBQWGGIUXGQDX77VTGPFIG6YT7G64ASOYHXQC print('down', State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
--? print('down', State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
print('switching pos of screen line at cursor from '..tostring(screen_line_starting_pos)..' to '..tostring(new_screen_line_starting_pos))
--? print('switching pos of screen line at cursor from '..tostring(screen_line_starting_pos)..' to '..tostring(new_screen_line_starting_pos))
print('=>', State.cursor1.line, State.cursor1.pos, State.screen_top1.line, State.screen_top1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
--? print('=>', State.cursor1.line, State.cursor1.pos, State.screen_top1.line, State.screen_top1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
print('snap cursor', State.top)print('cursor pos '..tostring(State.cursor1.pos)..' is on the #'..tostring(top2.screen_line)..' screen line down')
--? print('cursor pos '..tostring(State.cursor1.pos)..' is on the #'..tostring(top2.screen_line)..' screen line down')
print(('screen top changed from (%d,%d) to (%d,%d)'):format(old_top.line, old_top.pos, pane.screen_top1.line, pane.screen_top1.pos))print('updating viewport based on screen top')print('from', Display_settings.y, y_of_schema1(pane, pane.screen_top1))
--? print(('screen top changed from (%d,%d) to (%d,%d)'):format(old_top.line, old_top.pos, pane.screen_top1.line, pane.screen_top1.pos))--? print('updating viewport based on screen top')--? print('from', Display_settings.y, y_of_schema1(pane, pane.screen_top1))
--? if pane.cursor_x >= 0 and pane.cursor_x < App.screen.width and pane.cursor_y >= Header_height and pane.cursor_y < App.screen.height then--? add_hotkey_to_menu('ctrl+e: stop editing')--? add_hotkey_to_menu('ctrl+h on drawing: help')--? add_hotkey_to_menu('ctrl+f: find')--? add_hotkey_to_menu('alt+left alt+right: prev/next word')--? add_hotkey_to_menu('ctrl+z ctrl+y: undo/redo')--? add_hotkey_to_menu('ctrl+x ctrl+c ctrl+v: cut/copy/paste')--? else--? add_panning_hotkeys_to_menu()--? end
if pane.cursor_x >= 0 and pane.cursor_x < App.screen.width and pane.cursor_y >= Header_height and pane.cursor_y < App.screen.height thenadd_hotkey_to_menu('ctrl+e: stop editing')add_hotkey_to_menu('ctrl+h on drawing: help')add_hotkey_to_menu('ctrl+f: find')add_hotkey_to_menu('alt+left alt+right: prev/next word')add_hotkey_to_menu('ctrl+z ctrl+y: undo/redo')add_hotkey_to_menu('ctrl+x ctrl+c ctrl+v: cut/copy/paste')elseadd_panning_hotkeys_to_menu()end