diff options
| author | Stephen Blott | 2014-10-26 12:54:07 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2014-10-26 12:54:07 +0000 | 
| commit | d2224397a2d6bb9fd897da338e59343853eef62b (patch) | |
| tree | 5ed8586ab3ab47eb8f1daa5fae6a652655ac6204 /background_scripts | |
| parent | 33406947a1b776c1aca7701668220e1967f6bb5c (diff) | |
| download | vimium-d2224397a2d6bb9fd897da338e59343853eef62b.tar.bz2 | |
Limit repeats, minor refactoring.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/commands.coffee | 1 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 34 | 
2 files changed, 17 insertions, 18 deletions
| diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index c3bc457a..7d2dccd9 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -202,6 +202,7 @@ defaultKeyMappings =  # This is a mapping of: commandIdentifier => [description, options]. +# If the noRepeat and repeatLimit options are both specified, then noRepeat takes precedence.  commandDescriptions =    # Navigating the current page    showHelp: ["Show help", { background: true }] diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 33425d90..898f46f1 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -531,7 +531,6 @@ checkKeyQueue = (keysToCheck, tabId, frameId) ->    if (Commands.keyToCommandRegistry[command])      registryEntry = Commands.keyToCommandRegistry[command] -      runCommand = true      if registryEntry.noRepeat @@ -544,24 +543,23 @@ checkKeyQueue = (keysToCheck, tabId, frameId) ->          Are you sure you want to continue?        """ -    if not runCommand -      # Do nothing, use has chosen not to execute the command -    else if not registryEntry.isBackgroundCommand -      chrome.tabs.sendMessage(tabId, -        name: "executePageCommand", -        command: registryEntry.command, -        frameId: frameId, -        count: count, -        passCountToFunction: registryEntry.passCountToFunction, -        completionKeys: generateCompletionKeys("")) -      refreshedCompletionKeys = true -    else -      if registryEntry.passCountToFunction -        BackgroundCommands[registryEntry.command](count) -      else if registryEntry.noRepeat -        BackgroundCommands[registryEntry.command]() +    if runCommand +      if not registryEntry.isBackgroundCommand +        chrome.tabs.sendMessage(tabId, +          name: "executePageCommand", +          command: registryEntry.command, +          frameId: frameId, +          count: count, +          passCountToFunction: registryEntry.passCountToFunction, +          completionKeys: generateCompletionKeys("")) +        refreshedCompletionKeys = true        else -        repeatFunction(BackgroundCommands[registryEntry.command], count, 0, frameId) +        if registryEntry.passCountToFunction +          BackgroundCommands[registryEntry.command](count) +        else if registryEntry.noRepeat +          BackgroundCommands[registryEntry.command]() +        else +          repeatFunction(BackgroundCommands[registryEntry.command], count, 0, frameId)      newKeyQueue = ""    else if (getActualKeyStrokeLength(command) > 1) | 
