diff options
| author | Stephen Blott | 2016-10-02 12:25:20 +0100 |
|---|---|---|
| committer | Stephen Blott | 2016-10-02 12:25:20 +0100 |
| commit | 54139c11231bf7e7a3a9f4c98fb688d2d0fe22c9 (patch) | |
| tree | cfb34113abb44bb8745828c7d932efe497d9b7c9 | |
| parent | d0092f4f078a7b590746092c78b91da35c6a403e (diff) | |
| download | vimium-54139c11231bf7e7a3a9f4c98fb688d2d0fe22c9.tar.bz2 | |
Better regexp (to match legacy behaviour for '<c->>'.
| -rw-r--r-- | background_scripts/commands.coffee | 3 | ||||
| -rw-r--r-- | tests/unit_tests/commands_test.coffee | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index e1f82b72..7ab09f24 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -44,7 +44,8 @@ Commands = parseKeySequence: (key) -> if key.length == 0 [] - else if 0 == key.search /^<([^<>]+)>(.*)/ # Parse "<c-a>bcd" as "<c-a>" and "bcd". + # Parse "<c-a>bcd" as "<c-a>" and "bcd". + else if 0 == key.search /^<((?:[acm]-)*(?:.|[a-zA-Z0-9]{2,}))>(.*)/i [modifiers..., keyChar] = RegExp.$1.split "-" keyChar = keyChar.toLowerCase() unless keyChar.length == 1 modifiers = (modifier.toLowerCase() for modifier in modifiers) diff --git a/tests/unit_tests/commands_test.coffee b/tests/unit_tests/commands_test.coffee index fbe470a0..c8ded6a9 100644 --- a/tests/unit_tests/commands_test.coffee +++ b/tests/unit_tests/commands_test.coffee @@ -43,6 +43,7 @@ context "Key mappings", @testKeySequence "<>", "</>", 2 @testKeySequence "<<space>", "</<space>", 2 + @testKeySequence "<C->>", "<c->>", 1 context "Validate commands and options", should "have either noRepeat or repeatLimit, but not both", -> |
