about summary refs log tree commit diff stats
path: root/app.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-04 14:14:26 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-04 14:54:40 -0700
commit1326914d7bda65a5791c2121dae6d3987a907994 (patch)
treeb8f47fd975f18540c62097e39cfb89fa3c5f4ddd /app.lua
parent98f50f0b404b48bc38d95126939aefa6c3bea139 (diff)
downloadlines.love-1326914d7bda65a5791c2121dae6d3987a907994.tar.gz
select text with shift + mouseclick
It's still a bit simple-minded. Most software will keep the first bound
fixed and move the second. Lines currently has the bounds in a queue of
sorts. But I have a test to indicate the behavior that is definitely
desired. We'll see if we need it to get more complex.
Diffstat (limited to 'app.lua')
-rw-r--r--app.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/app.lua b/app.lua
index 99c1cd2..b00506b 100644
--- a/app.lua
+++ b/app.lua
@@ -186,6 +186,18 @@ function App.setClipboardText(s)
   App.clipboard = s
 end
 
+App.modifier_keys = {}
+function App.keypress(key)
+  App.modifier_keys[key] = true
+end
+function App.keyrelease(key)
+  App.modifier_keys[key] = nil
+end
+
+function App.modifier_down(key)
+  return App.modifier_keys[key]
+end
+
 function App.run_after_textinput(t)
   App.textinput(t)
   App.screen.contents = {}
@@ -267,6 +279,9 @@ function App.disable_tests()
   App.filesystem = nil
   App.run_after_textinput = nil
   App.run_after_keychord = nil
+  App.keypress = nil
+  App.keyrelease = nil
+  App.modifier_keys = nil
   -- other methods dispatch to real hardware
   App.screen.print = love.graphics.print
   App.newText = love.graphics.newText
@@ -275,4 +290,5 @@ function App.disable_tests()
   App.open_for_writing = function(filename) return io.open(filename, 'w') end
   App.getClipboardText = love.system.getClipboardText
   App.setClipboardText = love.system.setClipboardText
+  App.modifier_down = love.keyboard.isDown
 end