From c7f6e87132850bbb7cee2bb4c86ace2af17c44b4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 2 Jul 2013 13:13:45 -0700 Subject: [PATCH] Only use event.which when key identifier is non-ASCII Previously event.which was used when it was less than the key identifier which broke fn-delete since that generates a valid key identifier but a lower event.which value that does not translate to 'delete' using the char code converter. Close #611 --- src/app/keymap.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/keymap.coffee b/src/app/keymap.coffee index 0b38958b8..50404d037 100644 --- a/src/app/keymap.coffee +++ b/src/app/keymap.coffee @@ -150,7 +150,7 @@ class Keymap if event.originalEvent.keyIdentifier.indexOf('U+') == 0 hexCharCode = event.originalEvent.keyIdentifier[2..] charCode = parseInt(hexCharCode, 16) - charCode = Math.min(event.which, charCode) if event.which? + charCode = event.which if !@isAscii(charCode) and @isAscii(event.which) key = @keyFromCharCode(charCode) else key = event.originalEvent.keyIdentifier.toLowerCase() @@ -171,6 +171,9 @@ class Keymap [modifiers..., key].join('-') + isAscii: (charCode) -> + 0 <= charCode <= 127 + keyFromCharCode: (charCode) -> switch charCode when 8 then 'backspace'