Fork of lines.love without drawings; useful starting point for further forks

bugfix in undo/redo

Scenario: paste in multiple lines press C-z to undo

Error: [string "edit.lua"]:172: line_cache is out of date; 10 elements when it should be 9 stack traceback: [C]: in function 'assert' edit.lua:172: in function 'draw' text.lua:1141: in function 'cursor_out_of_screen' edit.lua:469: in function 'keychord_press' run.lua:914: in function 'keychord_press' main.lua:261: in function 'keychord_press' keychord.lua:11: in function <[string "keychord.lua"]:5> app.lua:29: in function <[string "app.lua"]:29> [C]: in function 'xpcall' app.lua:29: in function <[string "app.lua"]:20> [C]: in function 'xpcall' [love "boot.lua"]:377: in function <[love "boot.lua"]:344>

The cause is the recent commit which got rid of patch_placeholders and left line_cache in an inconsistent state until the next Text.redraw_all(). This fork has a call to Text.cursor_out_of_screen between patch() and Text.redraw_all(). And Text.cursor_out_of_screen calls edit.draw, which requires the data structures to be consistent.

No other upstream/sibling fork has this pattern.

There was also a second bug, a bad call in C-y left in by the previous merge that I hadn't run into yet.

Created by  akkartik  on July 10, 2024
I2MXOJ3KK4F6NJ5RDDTBPT3CVRLY562O3REAOWMTIDSJXUDS3JLQC
Change contents