about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-16 15:08:49 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-16 15:14:08 -0700
commit34f9670215c4504a218864679b84adfe31f60a54 (patch)
tree87da782e9532e77d67943acd4247a6b2101a2f6a
parentff1d4d988aa1afe772f4d4056cbc2e567bfcba71 (diff)
downloadlines.love-34f9670215c4504a218864679b84adfe31f60a54.tar.gz
2 regressions:
- loading a file from the command line
- don't insert empty lines when loading a file from the command line
-rw-r--r--main.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/main.lua b/main.lua
index 3189aae..e062187 100644
--- a/main.lua
+++ b/main.lua
@@ -51,11 +51,6 @@ exec_payload = nil
 filename = nil
 
 function love.load(arg)
-  if #arg > 0 then
-    filename = arg[1]
-    lines = load_from_disk(filename)
-  end
-  table.insert(lines, '')
   -- maximize window
   love.window.setMode(0, 0)  -- maximize
   screenw, screenh, screenflags = love.window.getMode()
@@ -64,8 +59,14 @@ function love.load(arg)
   screenh = screenh-100
   love.window.setMode(screenw, screenh)
   love.window.setTitle("Text with Lines")
-  love.keyboard.setTextInput(true)  -- bring up keyboard on touch screen
   drawingw = math.floor(screenh/2/40)*40
+  love.keyboard.setTextInput(true)  -- bring up keyboard on touch screen
+  if #arg > 0 then
+    filename = arg[1]
+    lines = load_from_disk(filename)
+  else
+    table.insert(lines, '')
+  end
 end
 
 function love.draw()