diff options
| author | mrmr1993 | 2014-08-16 22:17:01 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2014-10-25 23:06:51 +0100 | 
| commit | d2ff14944b2b90812f29da8cd12de1b39f7f3404 (patch) | |
| tree | 9b884012e75ea95fe0be57ec7bb8743b447f0835 | |
| parent | a485fe7500ce0d8cad0b6f5a3d20b279d738521b (diff) | |
| download | vimium-d2ff14944b2b90812f29da8cd12de1b39f7f3404.tar.bz2 | |
Add noRepeat to relevent frontend commands
The use of Vomnibar commands with a numerical prefix > 1 is broken and
non-trivial to fix. This patch introduces the `noRepeat` property for
frontend commands, applying it to all Vomnibar commands and several
others.
| -rw-r--r-- | background_scripts/commands.coffee | 56 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 5 | 
2 files changed, 32 insertions, 29 deletions
| diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 3a85c6fd..33088830 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -205,43 +205,43 @@ commandDescriptions =    scrollUp: ["Scroll up"]    scrollLeft: ["Scroll left"]    scrollRight: ["Scroll right"] -  scrollToTop: ["Scroll to the top of the page"] -  scrollToBottom: ["Scroll to the bottom of the page"] -  scrollToLeft: ["Scroll all the way to the left"] -  scrollToRight: ["Scroll all the way to the right"] +  scrollToTop: ["Scroll to the top of the page", { noRepeat: true }] +  scrollToBottom: ["Scroll to the bottom of the page", { noRepeat: true }] +  scrollToLeft: ["Scroll all the way to the left", { noRepeat: true }] +  scrollToRight: ["Scroll all the way to the right", { noRepeat: true }] +    scrollPageDown: ["Scroll a page down"]    scrollPageUp: ["Scroll a page up"]    scrollFullPageDown: ["Scroll a full page down"]    scrollFullPageUp: ["Scroll a full page up"] -  reload: ["Reload the page"] -  toggleViewSource: ["View page source"] +  reload: ["Reload the page", { noRepeat: true }] +  toggleViewSource: ["View page source", { noRepeat: true }] -  copyCurrentUrl: ["Copy the current URL to the clipboard"] -  'LinkHints.activateModeToCopyLinkUrl': ["Copy a link URL to the clipboard"] +  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 }] -  enterInsertMode: ["Enter insert mode"] +  enterInsertMode: ["Enter insert mode", { noRepeat: true }]    focusInput: ["Focus the first text box on the page. Cycle between them using tab",      { passCountToFunction: true }] -  "LinkHints.activateMode": ["Open a link in the current tab"] -  "LinkHints.activateModeToOpenInNewTab": ["Open a link in a new tab"] -  "LinkHints.activateModeToOpenInNewForegroundTab": ["Open a link in a new tab & switch to it"] -  "LinkHints.activateModeWithQueue": ["Open multiple links in a new tab"] - -  "LinkHints.activateModeToOpenIncognito": ["Open a link in incognito window"] +  "LinkHints.activateMode": ["Open a link in the current tab", { noRepeat: true }] +  "LinkHints.activateModeToOpenInNewTab": ["Open a link in a new tab", { noRepeat: true }] +  "LinkHints.activateModeToOpenInNewForegroundTab": ["Open a link in a new tab & switch to it", { noRepeat: true }] +  "LinkHints.activateModeWithQueue": ["Open multiple links in a new tab", { noRepeat: true }] +  "LinkHints.activateModeToOpenIncognito": ["Open a link in incognito window", { noRepeat: true }] +  "LinkHints.activateModeToDownloadLink": ["Download link url", { noRepeat: true }] -  "LinkHints.activateModeToDownloadLink": ["Download link url"] -  enterFindMode: ["Enter find mode"] +  enterFindMode: ["Enter find mode", { noRepeat: true }]    performFind: ["Cycle forward to the next find match"]    performBackwardsFind: ["Cycle backward to the previous find match"] -  goPrevious: ["Follow the link labeled previous or <"] -  goNext: ["Follow the link labeled next or >"] +  goPrevious: ["Follow the link labeled previous or <", { noRepeat: true }] +  goNext: ["Follow the link labeled next or >", { noRepeat: true }]    # Navigating your history    goBack: ["Go back in history", { passCountToFunction: true }] @@ -270,18 +270,18 @@ commandDescriptions =    moveTabLeft: ["Move tab to the left", { background: true, passCountToFunction: true }]    moveTabRight: ["Move tab to the right", { background: true, passCountToFunction: true  }] -  "Vomnibar.activate": ["Open URL, bookmark, or history entry"] -  "Vomnibar.activateInNewTab": ["Open URL, bookmark, history entry, in a new tab"] -  "Vomnibar.activateTabSelection": ["Search through your open tabs"] -  "Vomnibar.activateBookmarks": ["Open a bookmark"] -  "Vomnibar.activateBookmarksInNewTab": ["Open a bookmark in a new tab"] -  "Vomnibar.activateEditUrl": ["Edit the current URL"] -  "Vomnibar.activateEditUrlInNewTab": ["Edit the current URL and open in a new tab"] +  "Vomnibar.activate": ["Open URL, bookmark, or history entry", { noRepeat: true }] +  "Vomnibar.activateInNewTab": ["Open URL, bookmark, history entry, in a new tab", { noRepeat: true }] +  "Vomnibar.activateTabSelection": ["Search through your open tabs", { noRepeat: true }] +  "Vomnibar.activateBookmarks": ["Open a bookmark", { noRepeat: true }] +  "Vomnibar.activateBookmarksInNewTab": ["Open a bookmark in a new tab", { noRepeat: true }] +  "Vomnibar.activateEditUrl": ["Edit the current URL", { noRepeat: true }] +  "Vomnibar.activateEditUrlInNewTab": ["Edit the current URL and open in a new tab", { noRepeat: true }]    nextFrame: ["Cycle forward to the next frame on the page", { background: true, passCountToFunction: true }] -  "Marks.activateCreateMode": ["Create a new mark"] -  "Marks.activateGotoMode": ["Go to a mark"] +  "Marks.activateCreateMode": ["Create a new mark", { noRepeat: true }] +  "Marks.activateGotoMode": ["Go to a mark", { noRepeat: true }]  Commands.init() diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 352cfa48..b8878358 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -526,7 +526,10 @@ checkKeyQueue = (keysToCheck, tabId, frameId) ->    if (Commands.keyToCommandRegistry[command])      registryEntry = Commands.keyToCommandRegistry[command] -    if !registryEntry.isBackgroundCommand +    if registryEntry.noRepeat +      count = 1 + +    if not registryEntry.isBackgroundCommand        chrome.tabs.sendMessage(tabId,          name: "executePageCommand",          command: registryEntry.command, | 
