about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-12 07:02:24 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-12 07:03:35 -0700
commitff88a2a927f3088083c6a8f4415e7d71e379f42e (patch)
tree97d67c57b91c42bf6bd1d4ba51e560b3a6d2d535
parentff88238ff1b1eea63a3e4d827ed0e9acb254d0d1 (diff)
downloadtext.love-ff88a2a927f3088083c6a8f4415e7d71e379f42e.tar.gz
bugfix in commit e51ce12969
Any time I press a ctrl- chord LÖVE actually sees two key chords:
  C-lctrl
  C-... (the real one)

But it's not just that. There's also a lot in the codebase that's just
habit-based. I need more tests.
-rw-r--r--main.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/main.lua b/main.lua
index e3d2ef4..98d2707 100644
--- a/main.lua
+++ b/main.lua
@@ -449,10 +449,12 @@ function App.keychord_pressed(chord)
   elseif love.mouse.isDown('1') or chord:sub(1,2) == 'C-' then
     -- DON'T reset line.y here
     local drawing_index, drawing = Drawing.current_drawing()
-    local before = snapshot(drawing_index)
-    Drawing.keychord_pressed(chord)
-    record_undo_event({before=before, after=snapshot(drawing_index)})
-    save_to_disk(Lines, Filename)
+    if drawing_index then
+      local before = snapshot(drawing_index)
+      Drawing.keychord_pressed(chord)
+      record_undo_event({before=before, after=snapshot(drawing_index)})
+      save_to_disk(Lines, Filename)
+    end
   elseif chord == 'escape' and love.mouse.isDown('1') then
     local _,drawing = Drawing.current_drawing()
     if drawing then