diff options
| author | Stephen Blott | 2014-11-23 15:49:00 +0000 |
|---|---|---|
| committer | Stephen Blott | 2014-11-23 15:49:00 +0000 |
| commit | 76d3e7bc391542655c6a4ac25ef44c75aa1f0b12 (patch) | |
| tree | 22b5af7282c398b94a44a68a818762beccbadd71 | |
| parent | d8c5f8209ae07a41dd2cf57e52b5ec7e3d50dd05 (diff) | |
| download | vimium-76d3e7bc391542655c6a4ac25ef44c75aa1f0b12.tar.bz2 | |
Frames; always start rotation from the current frame.
| -rw-r--r-- | background_scripts/main.coffee | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index e8a57fd5..27800ce6 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -282,9 +282,12 @@ BackgroundCommands = { name: "toggleHelpDialog", dialogHtml: helpDialogHtml(), frameId:frameId })) moveTabLeft: (count) -> moveTab(null, -count) moveTabRight: (count) -> moveTab(null, count) - nextFrame: (count) -> + nextFrame: (count,frameId) -> chrome.tabs.getSelected(null, (tab) -> - frames = frameIdsForTab[tab.id] = frameIdsForTab[tab.id].rotate(count) + # We can't always track which frame chrome has focussed, but here we learn that it's frameId; so add an + # additional offset such that we do indeed start from frameId. + offset = Math.max 0, frameIdsForTab[tab.id].indexOf frameId + frames = frameIdsForTab[tab.id] = frameIdsForTab[tab.id].rotate(count+offset) chrome.tabs.sendMessage(tab.id, { name: "focusFrame", frameId: frames[0], highlight: true })) closeTabsOnLeft: -> removeTabsRelative "before" @@ -548,9 +551,9 @@ checkKeyQueue = (keysToCheck, tabId, frameId) -> refreshedCompletionKeys = true else if registryEntry.passCountToFunction - BackgroundCommands[registryEntry.command](count) + BackgroundCommands[registryEntry.command](count, frameId) else if registryEntry.noRepeat - BackgroundCommands[registryEntry.command]() + BackgroundCommands[registryEntry.command](frameId) else repeatFunction(BackgroundCommands[registryEntry.command], count, 0, frameId) |
