aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2014-11-24 06:00:44 +0000
committerStephen Blott2014-11-24 06:00:44 +0000
commitb83165dd1f279c2b139401bd9efc075bc89cf060 (patch)
tree184e4581cf5ec0eb0cb975f233510c25159feb91
parent5bde38eda9e855a7ef673f3e57d07826d4d00ffe (diff)
downloadvimium-b83165dd1f279c2b139401bd9efc075bc89cf060.tar.bz2
Frames; eliminate Array::rotate (and support large counts).
-rw-r--r--background_scripts/main.coffee4
1 files changed, 2 insertions, 2 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 48b54492..3ec618c9 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -284,10 +284,10 @@ BackgroundCommands =
moveTabRight: (count) -> moveTab(null, count)
nextFrame: (count,frameId) ->
chrome.tabs.getSelected(null, (tab) ->
+ frames = frameIdsForTab[tab.id]
# 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.
- count += Math.max 0, frameIdsForTab[tab.id].indexOf frameId
- frames = frameIdsForTab[tab.id]
+ count = (count + Math.max 0, frameIdsForTab[tab.id].indexOf frameId) % frames.length
frames = frameIdsForTab[tab.id] = [frames[count..]..., frames[0...count]...]
chrome.tabs.sendMessage(tab.id, { name: "focusFrame", frameId: frames[0], highlight: true }))