aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/commands.coffee
diff options
context:
space:
mode:
authorStephen Blott2016-02-28 08:34:14 +0000
committerStephen Blott2016-03-05 05:38:30 +0000
commita7136933b3e63ec5a7a50cd1dab9547b51f2d6d9 (patch)
tree8970180ae65fd364055a864ada98054651beda9a /background_scripts/commands.coffee
parentf89b58f04af3eae05de9e999c39b2fe047fe6f4a (diff)
downloadvimium-a7136933b3e63ec5a7a50cd1dab9547b51f2d6d9.tar.bz2
Key bindings; handle overlapping bindings
With: map g something map gg somethingElse The mapping for "g" always takes priority, regardless of the order in which they're encountered in `@keyToCommandRegistry`.
Diffstat (limited to 'background_scripts/commands.coffee')
-rw-r--r--background_scripts/commands.coffee4
1 files changed, 3 insertions, 1 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee
index 2982b861..10d20753 100644
--- a/background_scripts/commands.coffee
+++ b/background_scripts/commands.coffee
@@ -106,7 +106,9 @@ Commands =
while 0 < keys.length
[key, rest] = if 0 == keys.search @namedKeyRegex then [RegExp.$1, RegExp.$2] else [keys[0], keys[1..]]
if 0 < rest.length
- currentMapping = currentMapping[key] ?= {}
+ # Do not overwrite existing command bindings, they take priority.
+ break if (currentMapping[key] ?= {}).command
+ currentMapping = currentMapping[key]
else
currentMapping[key] = registryEntry
keys = rest