about summary refs log tree commit diff stats
path: root/main.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-03 21:03:52 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-03 21:03:52 -0700
commitea40a9b661e09ec6d4e74ac277ea785823ff03f0 (patch)
tree2852616824167c72f444e730e64f19bd354f79dd /main.lua
parent826207a54aabc4c2e77d2230ae9d846e50a9cb1e (diff)
downloadlines.love-ea40a9b661e09ec6d4e74ac277ea785823ff03f0.tar.gz
bugfix
Gracefully degrade if previously edited file shrinks.
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index 17a19e5..4f6fd00 100644
--- a/main.lua
+++ b/main.lua
@@ -128,7 +128,7 @@ function App.initialize(arg)
     end
   else
     Lines = load_from_disk(Filename)
-    if Lines[Cursor1.line].mode ~= 'text' then
+    if Cursor1.line > #Lines or Lines[Cursor1.line].mode ~= 'text' then
       for i,line in ipairs(Lines) do
         if line.mode == 'text' then
           Cursor1.line = i