fix: Restore tab position within workspace on cross-workspace undo close tab#12341
fix: Restore tab position within workspace on cross-workspace undo close tab#123417ito wants to merge 1 commit intozen-browser:devfrom
Conversation
|
I would rather figure out why the tab isn't positioned at the correct position in the first time. Maybe we should use the tab's "current" position before switching its space and tanslate it over? |
src/zen/workspaces/ZenWorkspaces.mjs
Outdated
| } | ||
|
|
||
| moveTabsToWorkspace(tabs, workspaceID) { | ||
| moveTabsToWorkspace(tabs, workspaceID, tabIndex) { |
There was a problem hiding this comment.
What I meant was that, we dont need this as a parameter. We can just use the same location the tab would be in before gBrowser.zenHandleTabMove. You could use, for example, tab._tPos
… as _zenRestoreTPos in tabbrowser. zenWorkspaces uses _zenRestoreTPos ?? _tPos with >= comparison, clears the transient field after the move, and inserts in the correct index (before the correct workspace item).
cbfa4e7 to
ade5415
Compare
|
To avoid adding a parameter to moveTabsToWorkspace, the restore flow now records a tab’s pre‑close position as a short‑lived _zenRestoreTPos, which is used to pick the insertion point in the workspace (normal tabs only). About the >= condition: once a tab closes, everything after it shifts up by one, so using >= lines up the pre‑close position with the right slot and avoids the off‑by‑one jump. I think this approach keeps the original order across workspaces without persisting extra state or changing method signatures now? Thanks for the reviews! |
When a tab is closed in one workspace and restored (Ctrl+Shift+T) from a different workspace, the tab was always appended to the bottom of the workspace's tab list instead of its original position/index.
This implements a fix that saves the workspace tab index at close time and uses it to insert the tab at the correct position during restore.
Changes: