diff options
| author | mrmr1993 | 2014-08-16 23:34:52 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2014-10-25 23:06:51 +0100 | 
| commit | a86cfb88b033a094de1783546898895b7fbe0cf5 (patch) | |
| tree | 3df4465ff968050c85881c11706ea7191037b55b /background_scripts/commands.coffee | |
| parent | d2ff14944b2b90812f29da8cd12de1b39f7f3404 (diff) | |
| download | vimium-a86cfb88b033a094de1783546898895b7fbe0cf5.tar.bz2 | |
Prompt for confirmation when executing large numbers of repeats
Implement `repeatLimit`, to prompt for confirmation before repeating a
command a large number of times, and apply it to tab creation/deletion
commands.
Diffstat (limited to 'background_scripts/commands.coffee')
| -rw-r--r-- | background_scripts/commands.coffee | 22 | 
1 files changed, 14 insertions, 8 deletions
| diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 33088830..c3bc457a 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -22,17 +22,21 @@ Commands =        isBackgroundCommand: options.background        passCountToFunction: options.passCountToFunction        noRepeat: options.noRepeat +      repeatLimit: options.repeatLimit    mapKeyToCommand: (key, command) ->      unless @availableCommands[command]        console.log(command, "doesn't exist!")        return +    commandDetails = @availableCommands[command] +      @keyToCommandRegistry[key] =        command: command -      isBackgroundCommand: @availableCommands[command].isBackgroundCommand -      passCountToFunction: @availableCommands[command].passCountToFunction -      noRepeat: @availableCommands[command].noRepeat +      isBackgroundCommand: commandDetails.isBackgroundCommand +      passCountToFunction: commandDetails.passCountToFunction +      noRepeat: commandDetails.noRepeat +      repeatLimit: commandDetails.repeatLimit    unmapKey: (key) -> delete @keyToCommandRegistry[key] @@ -222,7 +226,7 @@ commandDescriptions =    copyCurrentUrl: ["Copy the current URL to the clipboard", { noRepeat: true }]    "LinkHints.activateModeToCopyLinkUrl": ["Copy a link URL to the clipboard", { noRepeat: true }]    openCopiedUrlInCurrentTab: ["Open the clipboard's URL in the current tab", { background: true }] -  openCopiedUrlInNewTab: ["Open the clipboard's URL in a new tab", { background: true }] +  openCopiedUrlInNewTab: ["Open the clipboard's URL in a new tab", { background: true, repeatLimit: 3 }]    enterInsertMode: ["Enter insert mode", { noRepeat: true }] @@ -256,10 +260,12 @@ commandDescriptions =    previousTab: ["Go one tab left", { background: true }]    firstTab: ["Go to the first tab", { background: true }]    lastTab: ["Go to the last tab", { background: true }] -  createTab: ["Create new tab", { background: true }] -  duplicateTab: ["Duplicate current tab", { background: true }] -  removeTab: ["Close current tab", { background: true, noRepeat: true }] -  restoreTab: ["Restore closed tab", { background: true }] + +  createTab: ["Create new tab", { background: true, repeatLimit: 2 }] +  duplicateTab: ["Duplicate current tab", { background: true, repeatLimit: 2 }] +  removeTab: ["Close current tab", { background: true, repeatLimit: 3 }] +  restoreTab: ["Restore closed tab", { background: true, repeatLimit: 3 }] +    moveTabToNewWindow: ["Move tab to new window", { background: true }]    togglePinTab: ["Pin/unpin current tab", { background: true }] | 
