mirror of
https://github.com/atom/atom.git
synced 2026-02-15 09:05:58 -05:00
Now that we remove binding sets, track binding set indices explicitly
Previously we relied on the length of the binding sets, but now that we remove them the length is not a strictly increasing number. This could cause problem when using the index to break specificity ties.
This commit is contained in:
@@ -8,6 +8,7 @@ BindingSet = require 'binding-set'
|
||||
module.exports =
|
||||
class Keymap
|
||||
bindingSets: null
|
||||
nextBindingSetIndex: 0
|
||||
bindingSetsByFirstKeystroke: null
|
||||
queuedKeystrokes: null
|
||||
|
||||
@@ -58,7 +59,7 @@ class Keymap
|
||||
bindKeys: (args...) ->
|
||||
name = args.shift() if args.length > 2
|
||||
[selector, bindings] = args
|
||||
bindingSet = new BindingSet(selector, bindings, @bindingSets.length, name)
|
||||
bindingSet = new BindingSet(selector, bindings, @nextBindingSetIndex++, name)
|
||||
@bindingSets.unshift(bindingSet)
|
||||
for keystrokes of bindingSet.commandsByKeystrokes
|
||||
keystroke = keystrokes.split(' ')[0] # only index by first keystroke
|
||||
|
||||
Reference in New Issue
Block a user