From ff88a2a927f3088083c6a8f4415e7d71e379f42e Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 12 Jun 2022 07:02:24 -0700 Subject: [PATCH] bugfix in commit e51ce12969 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- main.lua | 10 ++++++---- 1 file 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