gh-15295: Correct tab index calculation for CWLO (gh-15293)

This commit is contained in:
Andrey Bochkarev
2026-09-08 19:22:23 +03:00
committed by GitHub
parent 243a8791a0
commit 6d398dec63
2 changed files with 4 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index 43180487a2fac15b7a65fac94f233eeed9094990..ae1288974cae29da929f27b78ff8db542566eba2 100644
index 43180487a2fac15b7a65fac94f233eeed9094990..ef6d30eb681caeae48d15280687b3bc37dbadc37 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -514,6 +514,7 @@
@@ -523,7 +523,7 @@ index 43180487a2fac15b7a65fac94f233eeed9094990..ae1288974cae29da929f27b78ff8db54
+ } else {
+ gZenWorkspaces._tabToRemoveForEmpty = leftoverTab;
+ if (Services.prefs.getBoolPref("zen.workspaces.continue-where-left-off")) {
+ gZenWorkspaces._tabToSelect = selectTab - 2; // -1 for the offset, and another -1 for the empty tab.
+ gZenWorkspaces._tabToSelect = selectTab - 1; // -1 for the empty tab.
+ }
+ if (gZenWorkspaces._initialTab && !gZenVerticalTabsManager._canReplaceNewTab) {
+ gZenWorkspaces._initialTab._shouldRemove = true;
@@ -984,7 +984,7 @@ index 43180487a2fac15b7a65fac94f233eeed9094990..ae1288974cae29da929f27b78ff8db54
+ if (!gZenFolders.canDropElement(element, targetElement)) {
+ element = element.group;
+ }
+ if (!element.hasAttribute('zen-essential') && targetElement?.hasAttribute('zen-essential')) {
+ if (!element.hasAttribute('zen-essential') && targetElement?.hasAttribute('zen-essential')) {
+ targetElement = null;
+ moveBefore = false;
+ }

View File

@@ -872,7 +872,7 @@ class nsZenWorkspaces {
) {
this.log(`Found tab to select: ${this._tabToSelect}, ${tabs.length}`);
let tabToUse = gZenGlanceManager.getTabOrGlanceParent(
tabs[this._tabToSelect + 1] || this._emptyTab
tabs[this._tabToSelect] || this._emptyTab
);
gBrowser.selectedTab = tabToUse;
this._removedByStartupPage = true;