From 1326914d7bda65a5791c2121dae6d3987a907994 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 4 Jun 2022 14:14:26 -0700 Subject: 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. --- app.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app.lua') 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 -- cgit 1.4.1-2-gfad0