diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 40a8e5f7..6d90544b 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -1853,7 +1853,6 @@ TreeStyleTabBrowser.prototype = { if (parent) { this.attachTabTo(tab, parent, { dontExpand : true, - insertBefore : nextTab, dontUpdateIndent : true, dontAnimate : aWithoutAnimation }); @@ -1873,7 +1872,10 @@ TreeStyleTabBrowser.prototype = { } if (!parent) { - if (!nextTab) nextTab = this.getNextTab(tab); + if (nextTab == tab) + nextTab = this.getNextSiblingTab(tab); + else if (!nextTab) + nextTab = this.getNextTab(tab); let parentOfNext = this.getParentTab(nextTab); let newPos = -1; if (parentOfNext) { @@ -1884,6 +1886,9 @@ TreeStyleTabBrowser.prototype = { newPos = nextTab._tPos; if (newPos > tab._tPos) newPos--; } + else { + newPos = this.getTabs(b).snapshotLength - 1; + } if (newPos > -1) b.moveTabTo(tab, newPos); }