about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-05 12:55:36 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-05 12:55:36 -0700
commit612e08571fccb6987c83100c54a5206eddd1dcb3 (patch)
treeb262b9a99c1fc6a4dae75be1607a7ed1322f06d3
parentb1c7ebdca3ad96dc694125fade083c508b425889 (diff)
downloadview.love-612e08571fccb6987c83100c54a5206eddd1dcb3.tar.gz
autosave on cut/paste
-rw-r--r--main.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/main.lua b/main.lua
index d5a332d..3fb69f1 100644
--- a/main.lua
+++ b/main.lua
@@ -322,6 +322,7 @@ function App.keychord_pressed(chord)
     if s then
       App.setClipboardText(s)
     end
+    save_to_disk(Lines, Filename)
   elseif chord == 'C-v' then
     for _,line in ipairs(Lines) do line.y = nil end  -- just in case we scroll
     -- We don't have a good sense of when to scroll, so we'll be conservative
@@ -354,6 +355,7 @@ function App.keychord_pressed(chord)
     if Cursor_y*Line_width+Cursor_x + clipboard_width > Line_width*App.screen.height/Line_height then
       Text.snap_cursor_to_bottom_of_screen()
     end
+    save_to_disk(Lines, Filename)
     record_undo_event({before=before, after=snapshot(before_line, Cursor1.line)})
   -- dispatch to drawing or text
   elseif love.mouse.isDown('1') or chord:sub(1,2) == 'C-' then