mirror of
https://github.com/atom/atom.git
synced 2026-02-08 13:45:09 -05:00
The shift key is basically ignored now. Fixes #47.
We probably still want to handle the case where someone does `cmd-shift-a` by automatically upcasing `a`. This will only with with alpha keys though.
This commit is contained in:
@@ -46,10 +46,9 @@ class KeyBinder
|
||||
@handleEvent: (event) ->
|
||||
keys = []
|
||||
keys.push @modifierKeys.command if event.modifierFlags & OSX.NSCommandKeyMask
|
||||
keys.push @modifierKeys.shift if event.modifierFlags & OSX.NSShiftKeyMask
|
||||
keys.push @modifierKeys.control if event.modifierFlags & OSX.NSControlKeyMask
|
||||
keys.push @modifierKeys.alt if event.modifierFlags & OSX.NSAlternateKeyMask
|
||||
keys.push event.charactersIgnoringModifiers.toLowerCase().charCodeAt 0
|
||||
keys.push event.charactersIgnoringModifiers.charCodeAt 0
|
||||
|
||||
binding = keys.sort().join "-"
|
||||
|
||||
@@ -71,16 +70,16 @@ class KeyBinder
|
||||
key = null
|
||||
|
||||
for k in keys
|
||||
k = k.toLowerCase()
|
||||
if @modifierKeys[k]
|
||||
modifiers.push @modifierKeys[k]
|
||||
if modifier = @modifierKeys[k.toLowerCase()]
|
||||
modifiers.push modifier unless modifier == @modifierKeys['shift'] # Shift is implied? YES
|
||||
else if key
|
||||
throw "#{@name}: #{binding} specifies TWO keys, we don't handle that yet."
|
||||
else if @namedKeys[k]
|
||||
key = @namedKeys[k]
|
||||
else if namedKey = @namedKeys[k.toLowerCase()]
|
||||
key = namedKey
|
||||
else if k.length > 1
|
||||
throw "#{@name}: #{binding} uses an unknown key #{k}."
|
||||
else
|
||||
charCode = k.charCodeAt 0
|
||||
key = k.charCodeAt 0
|
||||
|
||||
modifiers.concat(key).sort().join "-"
|
||||
|
||||
Reference in New Issue
Block a user