From 38509ce26afd1df7288255bfbcae1705f7bf9d86 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Fri, 12 Feb 2016 07:43:55 +0000 Subject: PassNextKey; exclude single-character mappings. Consider: map q passNextKey This works fine in normal mode. However, in insert mode, when the user types "q" they expect "q" to be input. Any other behaviour would be pretty weird. Here, we filter out such mappings before the front end sees them. So, with: map q passNextKey map passNextKey both mappings work in normal mode, but only the second works in insert mode. This is probably the behaviour likely to cause least user confusion. --- background_scripts/commands.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'background_scripts/commands.coffee') diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 7367e696..80ca0f96 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -68,9 +68,11 @@ Commands = @keyToCommandRegistry = {} # Push the key mapping for passNextKey into Settings so that it's available in the front end for insert + # mode. We exclude single-key mappings (that is, printable keys) because when users press printable keys + # in insert mode they expect the character to be input, not to be droppped into some special Vimium # mode. Settings.set "passNextKeyKeys", - (key for own key of @keyToCommandRegistry when @keyToCommandRegistry[key].command == "passNextKey") + (key for own key of @keyToCommandRegistry when @keyToCommandRegistry[key].command == "passNextKey" and 1 < key.length) clearKeyMappingsAndSetDefaults: -> @keyToCommandRegistry = {} -- cgit v1.2.3