From 4305730d512276fd929eaf12b8c134e69df52437 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 2 Oct 2016 09:39:18 +0100 Subject: Rename normalizeKey to parseKeySequence. The new name better describes which the function does. --- background_scripts/commands.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'background_scripts/commands.coffee') diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 7d9839aa..09149786 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -41,7 +41,7 @@ Commands = # them you have to press "shift" as well. # We sort modifiers here to match the order used in keyboard_utils.coffee. # The return value is a sequence of keys: e.g. "b" -> ["", "", "b"]. - normalizeKey: (key) -> + parseKeySequence: (key) -> if key.length == 0 [] else if 0 == key.search /^<([^<>]+)>(.*)/ # Parse "bcd" as "" and "bcd". @@ -49,9 +49,9 @@ Commands = keyChar = keyChar.toLowerCase() unless keyChar.length == 1 modifiers = (modifier.toLowerCase() for modifier in modifiers) modifiers.sort() - ["<#{[modifiers..., keyChar].join "-"}>", @normalizeKey(RegExp.$2)...] + ["<#{[modifiers..., keyChar].join "-"}>", @parseKeySequence(RegExp.$2)...] else - [key[0], @normalizeKey(key[1..])...] + [key[0], @parseKeySequence(key[1..])...] parseCustomKeyMappings: (customKeyMappings) -> for line in customKeyMappings.split "\n" @@ -61,14 +61,14 @@ Commands = when "map" [ _, key, command, optionList... ] = tokens if command? and @availableCommands[command] - keySequence = @normalizeKey key + keySequence = @parseKeySequence key key = keySequence.join "" BgUtils.log "Mapping #{key} to #{command}" @mapKeyToCommand { key, command, keySequence, options: @parseCommandOptions command, optionList } when "unmap" if tokens.length == 2 - keySequence = @normalizeKey tokens[1] + keySequence = @parseKeySequence tokens[1] key = keySequence.join "" BgUtils.log "Unmapping #{key}" delete @keyToCommandRegistry[key] @@ -102,7 +102,7 @@ Commands = clearKeyMappingsAndSetDefaults: -> @keyToCommandRegistry = {} for own key, command of defaultKeyMappings - keySequence = @normalizeKey key + keySequence = @parseKeySequence key key = keySequence.join "" @mapKeyToCommand { key, command, keySequence } -- cgit v1.2.3