about summary refs log tree commit diff stats
path: root/source_text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-07-16 21:32:13 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-07-16 21:32:13 -0700
commitc7c54a00b69eeffe1b21cc0db47a764089bdf8bc (patch)
tree4e1bac29967586a00b4c58737ec8b26c65d21f8c /source_text.lua
parent57deb762f033538a2d00fa9a2a8ae6e11729329d (diff)
downloadtext.love-c7c54a00b69eeffe1b21cc0db47a764089bdf8bc.tar.gz
consistently schedule_save after all mutations
Diffstat (limited to 'source_text.lua')
-rw-r--r--source_text.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/source_text.lua b/source_text.lua
index 70bb610..9cc03ea 100644
--- a/source_text.lua
+++ b/source_text.lua
@@ -234,8 +234,8 @@ function Text.keychord_press(State, chord)
     if State.cursor_y > App.screen.height - State.line_height then
       Text.snap_cursor_to_bottom_of_screen(State, State.left, State.right)
     end
-    schedule_save(State)
     record_undo_event(State, {before=before, after=snapshot(State, before_line, State.cursor1.line)})
+    schedule_save(State)
   elseif chord == 'tab' then
     local before = snapshot(State, State.cursor1.line)
 --?     print(State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos)
@@ -245,8 +245,8 @@ function Text.keychord_press(State, chord)
       Text.snap_cursor_to_bottom_of_screen(State, State.left, State.right)
 --?       print('=>', State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos)
     end
-    schedule_save(State)
     record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)})
+    schedule_save(State)
   elseif chord == 'backspace' then
     if State.selection1.line then
       Text.delete_selection(State, State.left, State.right)
@@ -293,8 +293,8 @@ function Text.keychord_press(State, chord)
     end
     Text.clear_screen_line_cache(State, State.cursor1.line)
     assert(Text.le1(State.screen_top1, State.cursor1), ('screen_top (line=%d,pos=%d) is below cursor (line=%d,pos=%d)'):format(State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos))
-    schedule_save(State)
     record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)})
+    schedule_save(State)
   elseif chord == 'delete' then
     if State.selection1.line then
       Text.delete_selection(State, State.left, State.right)
@@ -327,8 +327,8 @@ function Text.keychord_press(State, chord)
       table.remove(State.line_cache, State.cursor1.line+1)
     end
     Text.clear_screen_line_cache(State, State.cursor1.line)
-    schedule_save(State)
     record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)})
+    schedule_save(State)
   --== shortcuts that move the cursor
   elseif chord == 'left' then
     Text.left(State)