Replace confirmCloseAllTabs with confirmOnClose#20055
Conversation
|
Apologies if this is not the proper place for this question: is it possible to implement a fourth setting that would mean "present a warning dialog when closing multiple tabs/panes at once AND at least one background tab is in Running State"? |
|
Feedback from bug bash (4/7):
|
|
Note to self: also figure out #20083 (sorry for the back and forth Hlsg!) |
lhecker
left a comment
There was a problem hiding this comment.
Found 1 2? bugs, otherwise LGTM.
| _RemoveTabs(tabsToRemove); | ||
|
|
||
| actionArgs.Handled(true); | ||
| actionArgs.Handled(!tabsToRemove.empty()); |
There was a problem hiding this comment.
Is this just a change on technical correctness or is there a common situation where tabsToRemove ends up being empty?
There was a problem hiding this comment.
This makes it so that if there aren't any tabs to remove, we don't mark the event as handled. We disable the option in the context menu, but a user can still call the appropriate action via a key binding. Marking it as unhandled means that we'll let the key chord pass through.
This comment has been minimized.
This comment has been minimized.
|
|
||
| auto FromJson(const Json::Value& json) | ||
| { | ||
| return BaseEnumMapper::FromJson(json); |
There was a problem hiding this comment.
curious - usually we don't need to override these...
|
|
||
| // BODGY: After a ContentDialog is dismissed, FindName() can no longer | ||
| // resolve children inside it. Use Content() to get the checkbox directly. | ||
| const auto checkbox = dialog.Content().as<CheckBox>(); |
There was a problem hiding this comment.
I would rather you assign a name to the checkbox with x:Name and use it directly. That is less fragile than "treat the content as a checkbox" which will crash when we add more content.
| } | ||
| dialog.Title(winrt::box_value(title)); | ||
| dialog.PrimaryButtonText(primary); | ||
| dialog.CloseButtonText(RS_(L"ConfirmCloseDialog_Cancel")); |
There was a problem hiding this comment.
This could be set in the resw, right
|
|
||
| QuitRequested.raise(nullptr, nullptr); | ||
| } | ||
|
|
There was a problem hiding this comment.
does this cause a behavioral change
## Summary of the Pull Request Replaces the `warning.confirmCloseAllTabs` setting with a `warning.confirmOnClose` enum setting that accepts the following: - `never`: don't present a warning dialog when closing a session - `automatic`: present a warning dialog when closing multiple tabs/panes at once - `always`: present a warning dialog when closing any session The confirmation dialog contains a "don't ask me again" checkbox. When checked, we update the setting to `never`. This setting also affects the following actions: - "close other tabs" - "close tabs after" - "close other panes" - "quit" The appropriate confirmation dialog is shown in these scenarios. We also present an aggregate dialog instead of prompting the user once per tab/pane. If there are no other tabs/panes, we don't present a dialog and treat the key binding as unhandled (passing the key through). ## References and Relevant Issues Iteration of microsoft#19944 ## Validation Steps Performed - closing a tab: - ✅ 1 pane --> no dialog - ✅ 2 panes --> dialog - ✅ action and middle clicking tab trigger same flow - close all other tabs: - ✅ no other tabs --> no dialog - ✅ 1 other tab --> dialog - close all other panes: - ✅ 1 pane --> no dialog - ✅ 2 panes --> dialog - close all tabs after the current tab: - ✅ no tabs after --> no dialog (even if tabs before) - ✅ 1 tab after --> dialog - close window: - ✅ 2 tabs --> dialog - ✅ 2 panes --> dialog - ✅ 1 tab with one pane --> no dialog - Quit the Terminal: - ✅ 3 windows --> dialog - ✅1 window --> dialog - ✅ "don't ask me again" checkbox checked --> setting changed to "never" - ✅ "never" --> no dialog for scenarios above - ✅ "always" --> dialog always appears, even when closing a single pane ## PR Checklist Closes microsoft#5301 Closes microsoft#6641 "don't ask me again" checkbox is also mentioned in microsoft#10000 Co-authored by @zadjii-msft



Summary of the Pull Request
Replaces the
warning.confirmCloseAllTabssetting with awarning.confirmOnCloseenum setting that accepts the following:never: don't present a warning dialog when closing a sessionautomatic: present a warning dialog when closing multiple tabs/panes at oncealways: present a warning dialog when closing any sessionThe confirmation dialog contains a "don't ask me again" checkbox. When checked, we update the setting to
never.This setting also affects the following actions:
The appropriate confirmation dialog is shown in these scenarios. We also present an aggregate dialog instead of prompting the user once per tab/pane. If there are no other tabs/panes, we don't present a dialog and treat the key binding as unhandled (passing the key through).
References and Relevant Issues
Iteration of #19944
Validation Steps Performed
PR Checklist
Closes #5301
Closes #6641
"don't ask me again" checkbox is also mentioned in #10000
Co-authored by @zadjii-msft