From 8587fcd8ca019c94d685701412764205ede2124f Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Fri, 11 Sep 2015 04:58:31 +0100 Subject: Fix moveTab for pinned tabs. Fixes #1814. (This fixes a problem that was introduced in the "fix" of #1727.) --- background_scripts/main.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 40d570ee..1a49c3cb 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -239,8 +239,10 @@ moveTab = (count) -> chrome.tabs.getAllInWindow null, (tabs) -> pinnedCount = (tabs.filter (tab) -> tab.pinned).length chrome.tabs.getSelected null, (tab) -> + minIndex = if tab.pinned then 0 else pinnedCount + maxIndex = (if tab.pinned then pinnedCount else tabs.length) - 1 chrome.tabs.move tab.id, - index: Math.max pinnedCount, Math.min tabs.length - 1, tab.index + count + index: Math.max minIndex, Math.min maxIndex, tab.index + count # Start action functions -- cgit v1.2.3