Reset pinned tabs on close, and add a recent-order close setting - #19
Merged
Merged
Conversation
Top Tabs: Close tab did nothing on a pinned tab, while bb's own Close on the same page opened New Thread and left the pin where it was. Both now reset the pin, as Arc does: it stays pinned, forgets where it was left so it next opens at the panel's start, and the strip moves past the other pins, as VS Code skips its pinned editors on a keyboard close. Pressing the shortcut again then closes an ordinary tab rather than stepping through every pin. The tab's ×, middle-click and the batch closes still leave pins alone. A new setting, "After closing a tab, go back to the last one you used", off by default, makes every close of the tab in view return to the tab in view before it, from the strip's existing `recent` list, as VS Code's focusRecentEditorAfterClose does. With nothing remembered still open it falls back to the neighbour. Leaving a pin follows it too. The rules are pure functions in tabs-model.ts (successorAfterClose's order, successorAfterPinClose, resetPinned, pageCloseAction, which the close command now shares), with tests. TopTabs holds back the reset pin's location while the strip leaves it, so it is not recorded again on the way out. Bumps Top Tabs to 0.2.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resetting a pin dropped its location for good. resetPinned now puts it on the closed list as an entry marked `reset`, and reopen gives the pin its location back instead of a new slot in the strip, so ⌃⇧T undoes the last close or reset, whichever came last. The marker is what tells a reset pin, still open, apart from a closed tab reopened another way, which reopen still passes over. Going back to the pin yourself takes the reset as it is: recordPath drops the entry, so a much later ⌃⇧T cannot pull the pin back to an old page. The menus' "Reopen closed tab" asks the same `reopenable` that reopen uses, rather than its own copy of the rule. Resets persist with the rest of the strip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Closing a pinned tab resets it, as Arc does. Top Tabs: Close tab used to do nothing on a pinned tab, and bb's own Close on that page opened New Thread and left the pin where it was. Both now:
⌃⇧T undoes a reset, taking the pin back to where it was, until you go back to the pin yourself. That takes the reset as it is, so a much later ⌃⇧T can't pull the pin back to an old page.
The tab's ×, middle-click, close-others and close-to-the-right still leave pins alone.
New setting: "After closing a tab, go back to the last one you used" (off by default). On, closing the tab in view returns to the tab in view before it, Threads included, like VS Code's
focusRecentEditorAfterClose. It reads the strip's existingrecentlist and falls back to the right-hand neighbour once nothing it remembers is still open. It covers every single-tab close (×, middle-click, context menu, bb's page Close, the command), and leaving a pin follows it too.How
lib/tabs-model.ts:successorAfterClosetakes aCloseOrder. NewsuccessorAfterPinClose,resetPinnedandpageCloseAction;closeCommandActionnow sharespageCloseAction, so the button and the shortcut cannot drift apart.components/TopTabs.tsx:closePinned, and bb's page Close routes pins to it. While the strip leaves a reset pin, aresettingref stops the location effect from recording the old path again on the way out.resetPinnedputs the old location onclosedas an entry markedreset;reopengives a reset pin its path back instead of a new slot, andrecordPathdrops the entry once you revisit the pin. The menus' "Reopen closed tab" now asks the samereopenableasreopen.server.ts: therecentAfterClosesetting. README and PLUGIN_OVERVIEW are updated.Testing
npm test(77 pass) andnpm run typecheck,npm run buildinplugins/top-tabs.🤖 Generated with Claude Code