[PR #9574] Separate between Close Tab Requested and Tab Closed flows #27637

Closed
opened 2026-01-31 09:23:11 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/9574

State: closed
Merged: Yes


Summary of the Pull Request

Currently, both when the tab is already closed, and when there is a
request to close a tab (might be rejected), we go through the same flow
in TerminalPage.

This might leave the system in inconsistent state, as the side-effects
of closing will persist even if the closing was aborted.

This PR separates between the two flows, by introducing a CloseRequested
event to the TabBase.

This event is used to inform the upper tier (the terminal page) about
the request and to trigger the same logic that happens when the tab is
closed directly from the terminal page (e.g., by clicking close on the
tab view).

The Closed event will be used only to handle the actual closing of the
tab. It will ensure that the tab gets removed from the terminal page if
required.

As a result, it a read-only pane will be closed non-interactively (aka
connection exits), the tab closed flow will be invoked, and no user
prompt will be shown.

References

PR Checklist

**Original Pull Request:** https://github.com/microsoft/terminal/pull/9574 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request Currently, both when the tab is already closed, and when there is a request to close a tab (might be rejected), we go through the same flow in TerminalPage. This might leave the system in inconsistent state, as the side-effects of closing will persist even if the closing was aborted. This PR separates between the two flows, by introducing a CloseRequested event to the TabBase. This event is used to inform the upper tier (the terminal page) about the request and to trigger the same logic that happens when the tab is closed directly from the terminal page (e.g., by clicking close on the tab view). The Closed event will be used only to handle the actual closing of the tab. It will ensure that the tab gets removed from the terminal page if required. As a result, it a read-only pane will be closed non-interactively (aka connection exits), the tab closed flow will be invoked, and no user prompt will be shown. ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes https://github.com/microsoft/terminal/issues/9572 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [ ] I've discussed this with core contributors already.
claunia added the pull-request label 2026-01-31 09:23:11 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27637