about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-06-05 22:21:04 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-06-05 22:21:04 -0700
commit9e173372178c2df1dd3f6599dea5fe3c37675c6e (patch)
tree5843646641409fd16efed47e2a039a416fb4d218
parent637e28f300def4172459dd1d6fdf6efd53200ea8 (diff)
downloadview.love-9e173372178c2df1dd3f6599dea5fe3c37675c6e.tar.gz
rename modifier_down to key_down
The old name was confusing, as its description showed.
-rw-r--r--app.lua4
-rw-r--r--keychord.lua8
-rw-r--r--reference.md3
3 files changed, 7 insertions, 8 deletions
diff --git a/app.lua b/app.lua
index 584b17b..89c7bf1 100644
--- a/app.lua
+++ b/app.lua
@@ -229,7 +229,7 @@ end
 function App.fake_key_release(key)
   App.fake_keys_pressed[key] = nil
 end
-function App.modifier_down(key)
+function App.key_down(key)
   return App.fake_keys_pressed[key]
 end
 
@@ -444,7 +444,7 @@ function App.disable_tests()
   App.getTime = love.timer.getTime
   App.getClipboardText = love.system.getClipboardText
   App.setClipboardText = love.system.setClipboardText
-  App.modifier_down = love.keyboard.isDown
+  App.key_down = love.keyboard.isDown
   App.mouse_move = love.mouse.setPosition
   App.mouse_down = love.mouse.isDown
   App.mouse_x = love.mouse.getX
diff --git a/keychord.lua b/keychord.lua
index 3b43519..16fa48d 100644
--- a/keychord.lua
+++ b/keychord.lua
@@ -34,19 +34,19 @@ function App.any_modifier_down()
 end
 
 function App.ctrl_down()
-  return App.modifier_down('lctrl') or App.modifier_down('rctrl')
+  return App.key_down('lctrl') or App.key_down('rctrl')
 end
 
 function App.alt_down()
-  return App.modifier_down('lalt') or App.modifier_down('ralt')
+  return App.key_down('lalt') or App.key_down('ralt')
 end
 
 function App.shift_down()
-  return App.modifier_down('lshift') or App.modifier_down('rshift')
+  return App.key_down('lshift') or App.key_down('rshift')
 end
 
 function App.cmd_down()
-  return App.modifier_down('lgui') or App.modifier_down('rgui')
+  return App.key_down('lgui') or App.key_down('rgui')
 end
 
 function App.is_cursor_movement(key)
diff --git a/reference.md b/reference.md
index 3234cfa..525ae86 100644
--- a/reference.md
+++ b/reference.md
@@ -251,8 +251,7 @@ visible on screen.
 
 ### keyboard primitives
 
-* `App.modifier_down(key)` -- returns `true` if the given key (doesn't
-  actually have to be just a modifier) is currently pressed.
+* `App.key_down(key)` -- returns `true` if the given key is currently pressed.
   (Based on [LÖVE](https://love2d.org/wiki/love.keyboard.isDown).)
 
 ### interacting with files