Replace confirmCloseAllTabs with confirmCloseOn#19944
Open
zadjii-msft wants to merge 3 commits intomainfrom
Open
Replace confirmCloseAllTabs with confirmCloseOn#19944zadjii-msft wants to merge 3 commits intomainfrom
confirmCloseAllTabs with confirmCloseOn#19944zadjii-msft wants to merge 3 commits intomainfrom
Conversation
|
Can this get reviewed? |
carlos-zamora
requested changes
Mar 11, 2026
Member
carlos-zamora
left a comment
There was a problem hiding this comment.
Infrastructure is solid. I'm a bit hesitant on the design for the new setting though. Here's some thoughts:
- Long-term, I think the golden-path should be to have a "don't ask me again" checkbox on the content dialogs (referenced as a checkbox in "Warnings" section here). It's more discoverable and it doesn't require users to go into the settings.
- The current design does have full fidelity with what users want, but I think enum flags are a bit more annoying to deal with for settings (may be personal preference). They're particularly annoying in the UI too (check boxes are more complicated than a toggle button or a dropdown imo).
- Here's my proposed design:
- replace
warning.confirmCloseAllTabswithwarning.confirmClosetrue--> always confirm a close (ignore state.json preferences)false(default) --> don't force confirmations (check state.json preferences)- NOTE: if the name's unclear, we can consider
warning.forceConfirmCloseorwarning.alwaysConfirmClose.
- add "don't ask me again" checkbox to...
CloseAllDialog(window w/ multiple tabs)CloseTabDialog(tab w/ multiple panes)ClosePaneDialog(pane w/ any content in it)
- Since we're writing to the state.json, we don't need to worry about reloading the settings
- When we can detect multiple processes in a pane, we don't need to update the settings. Just worry about detecting it, displaying a popup, and adding a checkbox.
- replace
Let me know what you think. Happy to get this over the finish line too. I just want to converge on a UX first.
Comment on lines
+65
to
+84
| void InteractionViewModel::SetConfirmCloseOnAlways(winrt::Windows::Foundation::IReference<bool> on) | ||
| { | ||
| auto current = ConfirmCloseOn(); | ||
| WI_UpdateFlag(current, Model::ConfirmCloseOn::Always, winrt::unbox_value<bool>(on)); | ||
| ConfirmCloseOn(current); | ||
| } | ||
|
|
||
| void InteractionViewModel::SetConfirmCloseOnMultipleTabs(winrt::Windows::Foundation::IReference<bool> on) | ||
| { | ||
| auto current = ConfirmCloseOn(); | ||
| WI_UpdateFlag(current, Model::ConfirmCloseOn::MultipleTabs, winrt::unbox_value<bool>(on)); | ||
| ConfirmCloseOn(current); | ||
| } | ||
|
|
||
| void InteractionViewModel::SetConfirmCloseOnMultiplePanes(winrt::Windows::Foundation::IReference<bool> on) | ||
| { | ||
| auto current = ConfirmCloseOn(); | ||
| WI_UpdateFlag(current, Model::ConfirmCloseOn::MultiplePanes, winrt::unbox_value<bool>(on)); | ||
| ConfirmCloseOn(current); | ||
| } |
Member
There was a problem hiding this comment.
The updated preview doesn't get displayed when you call any of these.
Easy fix though, just add this:
_NotifyChanges(L"ConfirmCloseOnPreview")
Comment on lines
+812
to
+822
| if (const auto strong = weak.get()) | ||
| { | ||
| if (warningResult != ContentDialogResult::Primary) | ||
| { | ||
| co_return; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| co_return; | ||
| } |
Member
There was a problem hiding this comment.
nit: I kinda liked the way you did it earlier in this file more
Suggested change
| if (const auto strong = weak.get()) | |
| { | |
| if (warningResult != ContentDialogResult::Primary) | |
| { | |
| co_return; | |
| } | |
| } | |
| else | |
| { | |
| co_return; | |
| } | |
| const auto strong = weak.get(); | |
| if (!string || warningResult != ContentDialogResult::Primary) | |
| { | |
| co_return; | |
| } |
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.
This PR adds support for a more nuanced enum-backed version of
confirmCloseAllTabs.The old setting was simply a bool true/false, and when set to true, it would warn the user when closing a terminal with more than one pane in it. This lacked fidelity for a variety of scenarios that I enumerated in #6549 (comment).
So instead, this PR changes that setting to a flag-based enum value. We're adding
warning.confirmCloseOn, which supports a number of values, which can be combined with one another:"multiplePanes"warn if closing any tab with more than one pane"multipleTabs"warn if closing a window with more than one tab"multipleProcesses"warn if closing a pane with more than one client attached"always"warn any time a pane/tab/window is about to be closed. Even if there is one pane in one tab with one client, warn.all(if all ===multiplePanes|multipleTabs|multipleProcesses)! That full set doesn't warn on one process in one pane."never"I think you can figure this outThe full behavior of these settings are captured in this spreadsheet:
Settings JSON Before / After
{ // Legacy boolean (default: true) "warning.confirmCloseAllTabs": true }{ // Flags enum — combine any of: // "always", "multipleTabs", // "multiplePanes", "multipleProcesses" "warning.confirmCloseOn": ["multipleTabs", "multiplePanes"] }{ "warning.confirmCloseAllTabs": false }{ // Never warn "warning.confirmCloseOn": [] }{ // Always warn on every close action "warning.confirmCloseOn": ["always"] }{ // Only warn when closing a tab with // multiple panes (not on window close) "warning.confirmCloseOn": ["multiplePanes"] }Looping back, these were the originally spec'd scenarios I had called out, and how those settings work after this PR:
"warning.confirmCloseOn": []or"warning.confirmCloseOn": ["never"]"warning.confirmCloseOn": ["multipleTabs"]"warning.confirmCloseOn": ["multiplePanes"]"warning.confirmCloseOn": ["multipleProcesses"]"warning.confirmCloseOn": ["always"]"warning.confirmCloseOn": ["multipleProcesses"]"warning.confirmCloseOn": ["always"]multipleProcessesFootnotes
multipleProcessesisn't implemented yet. Leonard is working on in-proc conpty, which will make that implementation trivial to do correctly. Without that, it is hard to correctly determine the full set of clients attached to a particular console server (without adding additional IPC to conpty) ↩ ↩2