From bdd0690bd478828a2d049c8177b2290b376f22ee Mon Sep 17 00:00:00 2001 From: int3 Date: Sat, 3 Apr 2010 02:30:58 +0800 Subject: Maintain accurate tab indices while ignoring chrome://newtab --- background_page.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/background_page.html b/background_page.html index da803e99..0aeb2a25 100644 --- a/background_page.html +++ b/background_page.html @@ -341,7 +341,14 @@ if (!openTabInfo) { return; } // This tab might've been opened before the extension was installed. // If we restore the new tab page, it'll ignore Vimium keystrokes when it reappears. - if (openTabInfo.url == "chrome://newtab/") { return; } + // Pretend it never existed and adjust tab indices accordingly. + if (openTabInfo.url == "chrome://newtab/") { + for (var i in tabQueue[openTabInfo.windowId]) { + if (tabQueue[openTabInfo.windowId][i].positionIndex > openTabInfo.positionIndex) { + tabQueue[openTabInfo.windowId][i].positionIndex--; + } + } + } if (tabQueue[openTabInfo.windowId]) tabQueue[openTabInfo.windowId].push(openTabInfo); -- cgit v1.2.3