feat: confirm before closing a tab/pane session#142
Draft
yoziv wants to merge 1 commit into
Draft
Conversation
Add an opt-in "Confirm before closing" setting so an accidental tab-X click or middle-click no longer kills a live terminal/AI session. - New confirmOnCloseSession setting (default off) in terminal-store, persisted via config and toggled from Settings > Tabs. - closeTerminal gains an opts.skipConfirm; when the setting is on it shows the existing tmax confirmDialog (danger) naming the session. - New closeTerminals(ids) so bulk closes (Close All / Close Others / close group / multi-select) show one aggregate confirm instead of one dialog per tab. Covers X-click, middle-click, context-menu close, Ctrl+Shift+W, and command palette since they all route through closeTerminal. Backlog: TASK-276 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 928d2772-f9cd-42d4-864a-24d999bd1328
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 & why
Reaching for a tab with the mouse and missing sometimes lands on the tab ✕ (or a middle-click), instantly killing a live terminal / AI session. This adds an opt-in confirmation before a tab/pane is closed.
Complements the existing "Hide tab close buttons" setting — instead of hiding the ✕, you keep it and confirm.
Changes
confirmOnCloseSession(default off, so no behavior change for existing users). Persisted via config; toggle added under Settings → Tabs ("Confirm before closing").closeTerminal(id, opts?)gainsopts.skipConfirm. When the setting is on and not skipped, it shows the existing tmax-styledconfirmDialog(danger variant) naming the session.closeTerminals(ids)action so bulk closes (Close All / Close Others / close group / multi-selectCtrl+Shift+W) show one aggregate "Close N sessions?" confirm instead of one dialog per tab.Single-close surfaces are all covered because they route through
closeTerminal: tab ✕-click, middle-click, context-menu Close,Ctrl+Shift+W, command palette, and TerminalPanel close buttons.User impact
Cross-platform
Pure renderer/store logic — no platform-specific APIs. Modifier handling for the shortcut path is unchanged.
Testing
tsc --noEmit: 0 new type errors (verified againstorigin/mainbaseline — identical error count before/after; pre-existing ambient API/xterm typings only).Ctrl+Shift+Wprompt; Close All prompts once for N tabs; toggle off → closes immediately as before.window.terminalAPI+confirmDialogat runtime); an e2e spec alongsidemiddle-click-titlebar-close.spec.tsis the right home for automated coverage and can follow.Backlog: TASK-276