From d8b4beb8bd1a53e3ee9bd640a2f4b1871452a6e0 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 26 Mar 2013 16:59:42 -0600 Subject: [PATCH] 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. --- src/app/keymap.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/keymap.coffee b/src/app/keymap.coffee index 068ccc606..71be30cec 100644 --- a/src/app/keymap.coffee +++ b/src/app/keymap.coffee @@ -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