diff options
| author | Stephen Blott | 2016-02-10 13:52:43 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-02-18 07:35:07 +0000 |
| commit | 201b51e1690bb993aa25a1c11f59afda6eab8747 (patch) | |
| tree | 290c99c4c10a0f4986e830ad077364862799ba2f | |
| parent | 02adaa7ad0c7921ebab5752470ff7f773802634c (diff) | |
| download | vimium-201b51e1690bb993aa25a1c11f59afda6eab8747.tar.bz2 | |
PassNextKey; allow multiple mappings.
This allows:
map a passNextKey
map b passNextKey
(Previously, we only picked up the first mapping.)
| -rw-r--r-- | background_scripts/commands.coffee | 14 | ||||
| -rw-r--r-- | content_scripts/mode_insert.coffee | 5 | ||||
| -rw-r--r-- | lib/settings.coffee | 2 |
3 files changed, 7 insertions, 14 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index b9a2ef72..7367e696 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -67,16 +67,10 @@ Commands = when "unmapAll" @keyToCommandRegistry = {} - # Push the mapping for passNextKey into Settings so that it's available in the front end for insert mode. - passNextKeyKey = null - for own key of @keyToCommandRegistry - if @keyToCommandRegistry[key].command == "passNextKey" - passNextKeyKey = key - break - if passNextKeyKey - Settings.set "passNextKeyKey", passNextKeyKey - else - Settings.clear "passNextKeyKey" + # Push the key mapping for passNextKey into Settings so that it's available in the front end for insert + # mode. + Settings.set "passNextKeyKeys", + (key for own key of @keyToCommandRegistry when @keyToCommandRegistry[key].command == "passNextKey") clearKeyMappingsAndSetDefaults: -> @keyToCommandRegistry = {} diff --git a/content_scripts/mode_insert.coffee b/content_scripts/mode_insert.coffee index 391e8c95..a35633ac 100644 --- a/content_scripts/mode_insert.coffee +++ b/content_scripts/mode_insert.coffee @@ -11,9 +11,8 @@ class InsertMode extends Mode handleKeyEvent = (event) => return @continueBubbling unless @isActive event - # Check for the pass-next-key key. - keyChar = KeyboardUtils.getKeyCharString event - if keyChar and keyChar == Settings.get "passNextKeyKey" + # Check for a pass-next-key key. + if KeyboardUtils.getKeyCharString(event) in Settings.get "passNextKeyKeys" new PassNextKeyMode return false diff --git a/lib/settings.coffee b/lib/settings.coffee index 2e5ddcc0..79ee04a9 100644 --- a/lib/settings.coffee +++ b/lib/settings.coffee @@ -174,7 +174,7 @@ Settings = settingsVersion: Utils.getCurrentVersion() helpDialog_showAdvancedCommands: false optionsPage_showAdvancedOptions: false - passNextKeyKey: "" + passNextKeyKeys: [] Settings.init() |
