aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2017-11-05 07:49:13 +0000
committerStephen Blott2017-11-05 07:49:13 +0000
commitc4cc76e9f6a0a99ebc297e420be739a0fc77f827 (patch)
treee19d3933ed2b36dae67581a5498c723eb65247db
parent1eceb1413b43b0b43f225a5270dc9f2e6c212836 (diff)
downloadvimium-c4cc76e9f6a0a99ebc297e420be739a0fc77f827.tar.bz2
Add more named keys (version 2)
This allows any special key to mapped, simply by using the `event.key` key name. E.g. map <enter> scrollDown Replaces #2770. Fixes #2769.
-rw-r--r--lib/keyboard_utils.coffee8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/keyboard_utils.coffee b/lib/keyboard_utils.coffee
index 681ee139..8cd2a490 100644
--- a/lib/keyboard_utils.coffee
+++ b/lib/keyboard_utils.coffee
@@ -5,7 +5,7 @@ Utils?.monitorChromeStorage "mapKeyRegistry", (value) => mapKeyRegistry = value
KeyboardUtils =
# This maps event.key key names to Vimium key names.
keyNames:
- "ArrowLeft": "left", "ArrowUp": "up", "ArrowRight": "right", "ArrowDown": "down", " ": "space", "Backspace": "backspace"
+ "ArrowLeft": "left", "ArrowUp": "up", "ArrowRight": "right", "ArrowDown": "down", " ": "space"
init: ->
if (navigator.userAgent.indexOf("Mac") != -1)
@@ -38,10 +38,8 @@ KeyboardUtils =
""
else if key.length == 1
key
- else if key.length == 2 and "F1" <= key <= "F9"
- key.toLowerCase() # F1 to F9.
- else if key.length == 3 and "F10" <= key <= "F12"
- key.toLowerCase() # F10 to F12.
+ else if 1 < key.length
+ key.toLowerCase()
else
""