Skip to content

Reset pinned tabs on close, and add a recent-order close setting - #19

Merged
matthewdias merged 2 commits into
mainfrom
top-tabs-pinned-close
Oct 4, 2026
Merged

matthewdias merged 2 commits into
mainfrom
top-tabs-pinned-close

Conversation

@matthewdias

@matthewdias matthewdias commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

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:

  • keep the tab pinned;
  • forget where it was left, so it next opens at the panel's start;
  • move past the other pins, as VS Code skips pinned editors on a keyboard close: to the first ordinary tab, or Threads if there is none. Pressing the shortcut again then closes an ordinary tab instead of stepping through every pin.

⌃⇧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 existing recent list 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: successorAfterClose takes a CloseOrder. New successorAfterPinClose, resetPinned and pageCloseAction; closeCommandAction now shares pageCloseAction, 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, a resetting ref stops the location effect from recording the old path again on the way out.
  • Reset undo: resetPinned puts the old location on closed as an entry marked reset; reopen gives a reset pin its path back instead of a new slot, and recordPath drops the entry once you revisit the pin. The menus' "Reopen closed tab" now asks the same reopenable as reopen.
  • server.ts: the recentAfterClose setting. README and PLUGIN_OVERVIEW are updated.
  • Bumps Top Tabs to 0.2.0.

Testing

  • npm test (77 pass) and npm run typecheck, npm run build in plugins/top-tabs.
  • Mutation-checked: each new rule was broken on purpose (no recent branch, pins not skipped, closed tabs not filtered, the command or bb's Close turned off on pins, unpinned tabs reset, a truthy setting value; for the undo: reset not remembered, the marker ignored, a revisit keeping the entry, the marker lost or loosened on reload, a reset reopened as a new slot) and every mutant failed a test.
  • Linked into bb from the branch: the pinned close and the setting were tried by hand. The ⌃⇧T undo is covered by tests and is live in the linked install, but has not been tried by hand yet.

🤖 Generated with Claude Code

matthewdias and others added 2 commits October 4, 2026 16:45
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>
@matthewdias
matthewdias merged commit 55bdbd2 into main Oct 4, 2026
1 check passed
@matthewdias
matthewdias deleted the top-tabs-pinned-close branch October 4, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant