Skip to content

feat(tui): reopen closed session tabs - #39731

Merged
kitlangton merged 1 commit into
v2from
tab-reopen
Jul 30, 2026
Merged

feat(tui): reopen closed session tabs#39731
kitlangton merged 1 commit into
v2from
tab-reopen

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Closing a tab was one-way: a misfired <leader>w meant hunting the session back down through the session list. This adds browser-style reopen — Reopen closed tab in the palette (Session category) and ctrl+shift+t by default — restoring the most recently user-closed tab at its original strip position.

How

  • packages/tui/src/context/session-tabs-model.ts: pure stack algebra. recordClosedSessionTab keeps one entry per session, capped at 10; reopenSessionTab pops the most recent entry not already open, restores it at its original (clamped) index, and consumes skipped entries so repeated presses walk the stack.
  • packages/tui/src/context/session-tabs.tsx: an in-memory closedTabs stack alongside the existing navigation history. Only user closes record entries — session.deleted prunes instead, so reopen never navigates to a dead session. reopen() restores the tab and navigates to it.
  • packages/tui/src/app.tsx + packages/tui/src/config/v1/keybind.ts: session.tab.reopen command wired to a new session_tab_reopen keybind (ctrl+shift+t), gated on tabs being enabled like the other tab commands.

Notes

  • ctrl+shift+t requires the Kitty keyboard protocol to be distinguishable from ctrl+t (variant_cycle); in plain terminals the binding simply never fires and the palette entry covers it — the same degradation as the existing ctrl+tab defaults.
  • The stack is per-instance and in-memory, matching tab navigation history; it does not persist across restarts.

Scope

No persistence of the closed stack, no "recently closed" list UI — single-command walk-back only.

Testing

  • cd packages/tui && bun typecheck
  • cd packages/tui && bun run test — 572 pass / 5 skip / 0 fail, including new model tests for original-position restore, skip-and-consume of already-open sessions, index clamping, per-session dedupe, and the 10-entry cap.

@kitlangton
kitlangton merged commit cc88305 into v2 Jul 30, 2026
3 checks passed
@kitlangton
kitlangton deleted the tab-reopen branch July 30, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant