This works but has a drawback: since we just adjust Editor.top, we render everything from Editor.top to bottom of screen. If we pan a long distance, Editor.top can become a large negative number and the editor will spend more and more time rendering things outside screen.
I suppose we'll find out what these no-op draws cost us.
4BX4GJEWW7Z5LA4SJUXADYLAHOYFL4IBOYH4J4DJYRAVKKGGFHGQC MXA3RZYKUI4UF2ISY7JEF6VKX6NOPZMZH5SLLCZHRJKFIXXXDPSAC 2ZRC7FULL5TSP77QJ4M3MOWPLYHM2MWGCDH6RT5FST6G3L5ZVFXQC X3F7ECSLGXCH6NBSDIH7LY47I4EG2RR5VFPEMM6ZVDYQIGFID4HQC BULPIBEGL7TMK6CVIE7IS7WGAHGOSUJBGJSFQK542MOWGHP2ADQQC UHB4GARJI5AB5UCDCZRFSCJNXGJSLU5DYGUGX5ITYEXI7Q43Z4CAC 3QQZ7W4EJ7G4HQM5IYWXICMAHVRGERY4X6AOC6LOV5NSZ4OBICSAC OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC BJ5X5O4ACBBJ56LRBBSTCW6IBQP4HAEOOOPNH3SKTA4F66YTOIDAC LF7BWEG4DKQI7NMXMZC4LC2BE5PB42HK5PD6OYBNIDMAZBJASOKQC WQOSZSUESLH4YRMW3PIWGSEC7RS243324PBROJP2KPRFJ3NFSEZQC 5MR22SGZE5YDU5CAIY53GNJDA6HSWBPYPD6M3FRQ5ZUMCSKTYJRAC AVTNUQYRBW7IX2YQ3KDLVQ23RGW3BAKTAE7P73ASBYNKOHMQMH5AC HFI2YR2CWHWTAIQMDM6HIHHBUKQ74WA2QXW72PSKZWKHSVFWLKSQC NEXUNNCF5PJC57XAMQGMSSYNI7MJ4ARWDY3HFGVYMGWG3MPHG7CQC LNUHQOGHIOFGJXNGA3DZLYEASLYYDGLN2I3EDZY5ANASQAHCG3YQC KVHUFUFVOSY6GB4XI2QK4T4WCLIYOV3NZR67TX6AQHAQDWJMEOBQC BYG5CEMVXANDTBI2ORNVMEY6K3EBRIHZHS4QBK27VONJC5537COQC 4KC7I3E2DIKLIP7LQRKB5WFA2Z5XZXAU46RFHNFQU5BVEJPDX6UQC 2L5MEZV344TOZLVY3432RHJFIRVXFD6O3GWLL5O4CV66BGAFTURQC BLWAYPKV3MLDZ4ALXLUJ25AIR6PCIL4RFYNRYLB26GFVC2KQBYBAC --? print('('..s(x)..','..s(y)..') '..frag..'('..s(frag_width)..' vs '..s(right)..') '..s(line_index)..' vs '..s(State.screen_top1.line)..'; '..s(pos)..' vs '..s(State.screen_top1.pos)..'; bottom: '..s(State.screen_bottom1.line)..'/'..s(State.screen_bottom1.pos))
--? print('('..s(x)..','..s(y)..') '..frag..'('..s(frag_width)..' vs '..s(State.right)..') '..s(line_index)..' vs '..s(State.screen_top1.line)..'; '..s(pos)..' vs '..s(State.screen_top1.pos)..'; bottom: '..s(State.screen_bottom1.line)..'/'..s(State.screen_bottom1.pos))
initialize_window_geometry(App.width(em))Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right)
initialize_window_geometry()Editor_state = edit.initialize_state(Margin_top, Margin_left, math.min(Margin_left+400, App.screen.width-Margin_right))
edit.update(Editor_state, dt)
if App.mouse_x() >= Editor_state.left-Margin_left and App.mouse_x() < Editor_state.right+Margin_right thenlove.mouse.setCursor(love.mouse.getSystemCursor('arrow'))edit.update(Editor_state, dt)elselove.mouse.setCursor(love.mouse.getSystemCursor('hand'))endif Pan.x thenEditor_state.left = Margin_left - math.max(Pan.x-App.mouse_x(), 0)Editor_state.right = 400 + Margin_right - math.max(Pan.x-App.mouse_x(), 0)Editor_state.width = Editor_state.right - Editor_state.leftEditor_state.top = Margin_top - math.max(Pan.y-App.mouse_y(), 0)--? Display_settings.x = math.max(Pan.x-App.mouse_x(), 0)--? Display_settings.y = math.max(Pan.y-App.mouse_y(), 0)--? App.mouse_move(Pan.x-Display_settings.x, Pan.y-Display_settings.y)end