diff options
| author | Stephen Blott | 2015-06-10 18:23:40 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-06-10 18:23:40 +0100 | 
| commit | 91bbb3122b58e834cc5512768eb09046fac2b448 (patch) | |
| tree | d4a9cfad5dd16774352f023e16263dbe52809c50 /background_scripts | |
| parent | f3e62301cf51fbeea77fb49eb90f1b7b9138d118 (diff) | |
| download | vimium-91bbb3122b58e834cc5512768eb09046fac2b448.tar.bz2 | |
Re-work tabMoveLeft/Right.
Note. This does not allow tabs to rotate from the left around to the
right, or vice versa.  Which means "999<<" moves the current tab all the
way to the left (and similarly to the right).
Fixes #1727 (kind of).
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/main.coffee | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 835b8a9a..6e1226b6 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -237,11 +237,11 @@ repeatFunction = (func, totalCount, currentCount, frameId) ->        -> repeatFunction(func, totalCount, currentCount + 1, frameId),        frameId) -moveTab = (callback, direction) -> -  chrome.tabs.getSelected(null, (tab) -> -    # Use Math.max to prevent -1 as the new index, otherwise the tab of index n will wrap to the far RHS when -    # moved left by exactly (n+1) places. -    chrome.tabs.move(tab.id, {index: Math.max(0, tab.index + direction) }, callback)) +moveTab = (count) -> +  chrome.tabs.getAllInWindow null, (tabs) -> +    chrome.tabs.getSelected null, (tab) -> +      chrome.tabs.move tab.id, +        index: Math.max 0, Math.min tabs.length - 1, tab.index + count  # Start action functions @@ -304,8 +304,8 @@ BackgroundCommands =      chrome.tabs.getSelected(null, (tab) ->        chrome.tabs.sendMessage(tab.id,          { name: "toggleHelpDialog", dialogHtml: helpDialogHtml(), frameId:frameId })) -  moveTabLeft: (count) -> moveTab(null, -count) -  moveTabRight: (count) -> moveTab(null, count) +  moveTabLeft: (count) -> moveTab -count +  moveTabRight: (count) -> moveTab count    nextFrame: (count,frameId) ->      chrome.tabs.getSelected null, (tab) ->        frameIdsForTab[tab.id] = cycleToFrame frameIdsForTab[tab.id], frameId, count | 
