about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-29 17:58:58 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-29 17:58:58 -0700
commitd009390cc4fa891d8c6399e12bb83567606156e2 (patch)
tree6a199e5cc448b1056209d6d5a76290d2a2c025a1 /main.lua
parentbfbe73e0efd2f80d5a2402ced3a93d6748319fbd (diff)
downloadlines.love-d009390cc4fa891d8c6399e12bb83567606156e2.tar.gz
bugfix: save previous file when dropping a new one on
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/main.lua b/main.lua
index 63c0e8d..b63c7fc 100644
--- a/main.lua
+++ b/main.lua
@@ -190,6 +190,11 @@ function initialize_font_settings(font_height)
 end
 
 function App.filedropped(file)
+  -- first make sure to save edits on any existing file
+  if Next_save then
+    save_to_disk(Lines, Filename)
+  end
+  -- clear the slate for the new file
   App.initialize_globals()  -- in particular, forget all undo history
   Filename = file:getFilename()
   file:open('r')