aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_page.html15
1 files changed, 10 insertions, 5 deletions
diff --git a/background_page.html b/background_page.html
index 23739081..d461d3d8 100644
--- a/background_page.html
+++ b/background_page.html
@@ -341,6 +341,7 @@
// We should update all the tabs in the old window and the new window.
if (openTabs[tabId]) {
updatePositionsAndWindowsForAllTabsInWindow(openTabs[tabId].windowId);
+ updateTabQueueIndices(openTabs[tabId].windowId, openTabs[tabId].positionIndex);
}
updatePositionsAndWindowsForAllTabsInWindow(attachedInfo.newWindowId);
});
@@ -349,17 +350,21 @@
updatePositionsAndWindowsForAllTabsInWindow(moveInfo.windowId);
});
+ function updateTabQueueIndices(windowId, positionIndex) {
+ for (var i in tabQueue[windowId]) {
+ if (tabQueue[windowId][i].positionIndex > positionIndex) {
+ tabQueue[windowId][i].positionIndex--;
+ }
+ }
+ }
+
chrome.tabs.onRemoved.addListener(function(tabId) {
var openTabInfo = openTabs[tabId];
// If we restore chrome:// pages, they'll ignore Vimium keystrokes when they reappear.
// Pretend they never existed and adjust tab indices accordingly.
// Could possibly expand this into a blacklist in the future
if (/^chrome[^:]*:\/\/.*/.test(openTabInfo.url)) {
- for (var i in tabQueue[openTabInfo.windowId]) {
- if (tabQueue[openTabInfo.windowId][i].positionIndex > openTabInfo.positionIndex) {
- tabQueue[openTabInfo.windowId][i].positionIndex--;
- }
- }
+ updateTabQueueIndices(openTabInfo.windowId, openTabInfo.positionIndex);
return;
}