aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephen Blott2017-09-01 16:54:20 +0100
committerStephen Blott2017-09-01 16:55:09 +0100
commit2c1c86ee35f8437473de11f47e6a3a754cb8c1e5 (patch)
treeb093bc8548a5685baf102d3abfbe7fcd310c9d23 /lib
parent1358fff3981cab5d8e0aa273cca2378aca2d766c (diff)
downloadvimium-2c1c86ee35f8437473de11f47e6a3a754cb8c1e5.tar.bz2
Use event.key for numpad.
See this comment: https://github.com/philc/vimium/pull/2626#issuecomment-326553282.
Diffstat (limited to 'lib')
-rw-r--r--lib/keyboard_utils.coffee5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/keyboard_utils.coffee b/lib/keyboard_utils.coffee
index 4b03aeed..7f05ef01 100644
--- a/lib/keyboard_utils.coffee
+++ b/lib/keyboard_utils.coffee
@@ -18,12 +18,13 @@ KeyboardUtils =
getKeyChar: (event) ->
unless Settings.get "ignoreKeyboardLayout"
key = event.key
+ else if event.code[...6] == "Numpad"
+ # We cannot correctly emulate the numpad, so fall back to event.key; see #2626.
+ key = event.key
else
# The logic here is from the vim-like-key-notation project (https://github.com/lydell/vim-like-key-notation).
key = event.code
- # Strip some standard prefixes.
key = key[3..] if key[...3] == "Key"
- key = key[6..] if key[...6] == "Numpad"
# Translate some special keys to event.key-like strings.
if @enUsTranslations[key]
key = if event.shift then @enUsTranslations[key][1] else @enUsTranslations[key][0]