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-14 09:05:02 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-14 09:05:02 -0700
commitc1d8201d4436b7d2544b79dbe0465558f887fd18 (patch)
tree22a39ec7832fba7b2d164627c7583870bb22029f /main.lua
parent4c39c436bfdebcf962051ad6ab7b574b33c53df9 (diff)
downloadtext.love-c1d8201d4436b7d2544b79dbe0465558f887fd18.tar.gz
mouse buttons are integers, not strings
Not sure where that idiom comes from or why strings work in some places
(auto-coercion?). I picked it up off some example apps. But
https://love2d.org/wiki/love.mouse.isDown says it should be an integer.
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/main.lua b/main.lua
index bc5d45a..db5d1ba 100644
--- a/main.lua
+++ b/main.lua
@@ -55,7 +55,7 @@ Cursor1 = {line=1, pos=1}  -- position of cursor
 Screen_bottom1 = {line=1, pos=1}  -- position of start of screen line at bottom of screen
 
 Selection1 = {}
-Old_cursor1, Old_selection1, Mousepress_shift = nil  -- some extra state to compute selection between mousepress and mouserelease
+Old_cursor1, Old_selection1, Mousepress_shift = nil  -- some extra state to compute selection between mouse press and release
 Recent_mouse = {}  -- when selecting text, avoid recomputing some state on every single frame
 
 Cursor_x, Cursor_y = 0, 0  -- in pixels
@@ -450,7 +450,7 @@ function App.keychord_pressed(chord)
     save_to_disk(Lines, Filename)
     record_undo_event({before=before, after=snapshot(before_line, Cursor1.line)})
   -- dispatch to drawing or text
-  elseif App.mouse_down('1') or chord:sub(1,2) == 'C-' then
+  elseif App.mouse_down(1) or chord:sub(1,2) == 'C-' then
     -- DON'T reset line.y here
     local drawing_index, drawing = Drawing.current_drawing()
     if drawing_index then
@@ -459,12 +459,12 @@ function App.keychord_pressed(chord)
       record_undo_event({before=before, after=snapshot(drawing_index)})
       save_to_disk(Lines, Filename)
     end
-  elseif chord == 'escape' and App.mouse_down('1') then
+  elseif chord == 'escape' and App.mouse_down(1) then
     local _,drawing = Drawing.current_drawing()
     if drawing then
       drawing.pending = {}
     end
-  elseif chord == 'escape' and not App.mouse_down('1') then
+  elseif chord == 'escape' and not App.mouse_down(1) then
     for _,line in ipairs(Lines) do
       if line.mode == 'drawing' then
         line.show_help = false