mirror of
https://github.com/atom/atom.git
synced 2026-02-08 13:45:09 -05:00
cmd-D, cmd-shift-d, and cmd-shift-D are now all the same binding
This commit is contained in:
@@ -18,13 +18,13 @@ class KeyBinder
|
||||
|
||||
load: (path) ->
|
||||
try
|
||||
Watcher.watch path, =>
|
||||
# Should we keep track of which file bindings are associated with?
|
||||
# That way we could clear bindings when the file is changed
|
||||
# or deleted. I think the answer is yes, but I don't want to
|
||||
# do this right now.
|
||||
console.log "#{@name}: Reloading #{path}"
|
||||
@load path
|
||||
# Watcher.watch path, =>
|
||||
# # Should we keep track of which file bindings are associated with?
|
||||
# # That way we could clear bindings when the file is changed
|
||||
# # or deleted. I think the answer is yes, but I don't want to
|
||||
# # do this right now.
|
||||
# console.log "#{@name}: Reloading #{path}"
|
||||
# @load path
|
||||
|
||||
json = CoffeeScript.eval "return " + (fs.read path)
|
||||
# Iterate in reverse order scopes are declared.
|
||||
@@ -45,7 +45,9 @@ class KeyBinder
|
||||
keys.push @modifierKeys.control
|
||||
if event.modifierFlags & OSX.NSAlternateKeyMask
|
||||
keys.push @modifierKeys.alt
|
||||
keys.push event.charactersIgnoringModifiers.charCodeAt 0
|
||||
if event.modifierFlags & OSX.NSShiftKeyMask
|
||||
keys.push @modifierKeys.shift
|
||||
keys.push event.charactersIgnoringModifiers.toLowerCase().charCodeAt 0
|
||||
|
||||
binding = keys.sort().join "-"
|
||||
|
||||
@@ -101,14 +103,17 @@ class KeyBinder
|
||||
|
||||
modifiers = []
|
||||
key = null
|
||||
|
||||
for k in keys
|
||||
if modifier = @modifierKeys[k.toLowerCase()]
|
||||
modifiers.push modifier unless modifier == @modifierKeys['shift'] # Shift is implied? YES
|
||||
modifiers.push modifier
|
||||
else if key
|
||||
throw "#{@name}: #{binding} specifies TWO keys, we don't handle that yet."
|
||||
else if namedKey = @namedKeys[k.toLowerCase()]
|
||||
key = namedKey
|
||||
else if shiftedKey = @shiftedKeys[k.charCodeAt 0]
|
||||
if not _.include modifiers, @modifierKeys.shift
|
||||
modifiers.push @modifierKeys.shift
|
||||
key = k.toLowerCase().charCodeAt 0
|
||||
else if k.length > 1
|
||||
throw "#{@name}: #{binding} uses an unknown key #{k}."
|
||||
else
|
||||
@@ -177,3 +182,12 @@ class KeyBinder
|
||||
'[': 219
|
||||
']': 221
|
||||
'\\': 220
|
||||
|
||||
shiftedKeys:
|
||||
48: ')', 49: '!', 50: '@', 51: '#', 52: '$', 53: '%', 54: '^'
|
||||
55: '&', 56: '*', 57: '(', 65: 'A', 66: 'B', 67: 'C', 68: 'D'
|
||||
69: 'E', 70: 'F', 71: 'G', 72: 'H', 73: 'I', 74: 'J', 75: 'K'
|
||||
76: 'L', 77: 'M', 78: 'N', 79: 'O', 80: 'P', 81: 'Q', 82: 'R'
|
||||
83: 'S', 84: 'T', 85: 'U', 86: 'V', 87: 'W', 88: 'X', 89: 'Y'
|
||||
90: 'Z', 186: ':', 187: '+', 188: '<', 189: '_', 190: '>'
|
||||
191: '?', 192: '~', 219: '{', 220: '|', 221: '}', 222: '"'
|
||||
|
||||
Reference in New Issue
Block a user