aboutsummaryrefslogtreecommitdiffstats
path: root/lib/keyboard_utils.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-02-09 11:40:53 +0000
committerStephen Blott2015-02-09 11:40:53 +0000
commit0bf605a934115083e700f5de090f39841417482a (patch)
tree408c191bd702da6847bca9943f6eba93ad28b209 /lib/keyboard_utils.coffee
parentac648a0e9f53c2fc359daa68309c25dd8c9db031 (diff)
parented306994697f6f9f5e13f9d018b5c7ffa2fff680 (diff)
downloadvimium-0bf605a934115083e700f5de090f39841417482a.tar.bz2
Merge branch 'visual-and-edit-modes'
Conflicts: background_scripts/main.coffee content_scripts/vimium_frontend.coffee lib/keyboard_utils.coffee
Diffstat (limited to 'lib/keyboard_utils.coffee')
-rw-r--r--lib/keyboard_utils.coffee9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/keyboard_utils.coffee b/lib/keyboard_utils.coffee
index 693c9b1c..5c95680c 100644
--- a/lib/keyboard_utils.coffee
+++ b/lib/keyboard_utils.coffee
@@ -1,6 +1,6 @@
KeyboardUtils =
keyCodes:
- { ESC: 27, backspace: 8, deleteKey: 46, enter: 13, space: 32, shiftKey: 16, ctrlKey: 17, f1: 112,
+ { ESC: 27, backspace: 8, deleteKey: 46, enter: 13, ctrlEnter: 10, space: 32, shiftKey: 16, ctrlKey: 17, f1: 112,
f12: 123, tab: 9, downArrow: 40, upArrow: 38 }
keyNames:
@@ -59,7 +59,12 @@ KeyboardUtils =
# identify any of chrome's own keyboard shortcuts as printable.
isPrintable: (event) ->
return false if event.metaKey or event.ctrlKey or event.altKey
- @getKeyChar(event)?.length == 1
+ keyChar =
+ if event.type == "keypress"
+ String.fromCharCode event.charCode
+ else
+ @getKeyChar event
+ keyChar.length == 1
KeyboardUtils.init()