feat(tui): reopen closed session tabs - #39731
Merged
Merged
Conversation
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
Closing a tab was one-way: a misfired
<leader>wmeant hunting the session back down through the session list. This adds browser-style reopen — Reopen closed tab in the palette (Session category) andctrl+shift+tby 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.recordClosedSessionTabkeeps one entry per session, capped at 10;reopenSessionTabpops 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-memoryclosedTabsstack alongside the existing navigation history. Only user closes record entries —session.deletedprunes 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.reopencommand wired to a newsession_tab_reopenkeybind (ctrl+shift+t), gated on tabs being enabled like the other tab commands.Notes
ctrl+shift+trequires the Kitty keyboard protocol to be distinguishable fromctrl+t(variant_cycle); in plain terminals the binding simply never fires and the palette entry covers it — the same degradation as the existingctrl+tabdefaults.Scope
No persistence of the closed stack, no "recently closed" list UI — single-command walk-back only.
Testing
cd packages/tui && bun typecheckcd 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.