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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9574
Author: @Don-Vito
Created: 3/21/2021
Status: Merged
Merged: 3/30/2021
Merged by: @undefined

Base: mainHead: 9502-fix-close-pane-flow


📝 Commits (8)

  • a3c8eb3 Remove reentrance protection from Pane::Close
  • c94ec21 Introduce CloseRequested event into TabBase
  • 659a53b Teach TerminalTab to use CloseRequested event
  • 0abfe0a Fix documentation in AppActionHandlers
  • 93906d3 Introduce separate flow for handling Closed and CloseRequested events
  • c1aff5c Merge remote-tracking branch 'upstream/main' into 9502-fix-close-pane-flow
  • 69377b9 Fix TerminalPage function signatures and formatting
  • 14aaa4a Merge remote-tracking branch 'origin/main' into HEAD

📊 Changes

9 files changed (+65 additions, -42 deletions)

View changed files

📝 src/cascadia/TerminalApp/AppActionHandlers.cpp (+2 -2)
📝 src/cascadia/TerminalApp/Pane.cpp (+2 -5)
📝 src/cascadia/TerminalApp/Pane.h (+0 -2)
📝 src/cascadia/TerminalApp/TabBase.cpp (+1 -1)
📝 src/cascadia/TerminalApp/TabBase.h (+1 -0)
📝 src/cascadia/TerminalApp/TabManagement.cpp (+35 -27)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+19 -2)
📝 src/cascadia/TerminalApp/TerminalPage.h (+4 -2)
📝 src/cascadia/TerminalApp/TerminalTab.cpp (+1 -1)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/9574 **Author:** [@Don-Vito](https://github.com/Don-Vito) **Created:** 3/21/2021 **Status:** ✅ Merged **Merged:** 3/30/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `9502-fix-close-pane-flow` --- ### 📝 Commits (8) - [`a3c8eb3`](https://github.com/microsoft/terminal/commit/a3c8eb3d59ea574ddea3af201748d59cb11bbcec) Remove reentrance protection from Pane::Close - [`c94ec21`](https://github.com/microsoft/terminal/commit/c94ec21655e91a8dafdefb96e8c3cf89b8ef6700) Introduce CloseRequested event into TabBase - [`659a53b`](https://github.com/microsoft/terminal/commit/659a53b1a0be41bc82e802e278e7580dadd7f1b8) Teach TerminalTab to use CloseRequested event - [`0abfe0a`](https://github.com/microsoft/terminal/commit/0abfe0a2a6ad952439cd7d8ae654fdb55d8cdff7) Fix documentation in AppActionHandlers - [`93906d3`](https://github.com/microsoft/terminal/commit/93906d34872f5b4a5c351d2bc31f4acd6e92f706) Introduce separate flow for handling Closed and CloseRequested events - [`c1aff5c`](https://github.com/microsoft/terminal/commit/c1aff5c263fc995dcc4a4ab32a6d85a915b8642e) Merge remote-tracking branch 'upstream/main' into 9502-fix-close-pane-flow - [`69377b9`](https://github.com/microsoft/terminal/commit/69377b998ee5442732fa6cf058a6c1321cbad245) Fix TerminalPage function signatures and formatting - [`14aaa4a`](https://github.com/microsoft/terminal/commit/14aaa4a1c51e08105c9f63b0c634c564b43a98fe) Merge remote-tracking branch 'origin/main' into HEAD ### 📊 Changes **9 files changed** (+65 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/AppActionHandlers.cpp` (+2 -2) 📝 `src/cascadia/TerminalApp/Pane.cpp` (+2 -5) 📝 `src/cascadia/TerminalApp/Pane.h` (+0 -2) 📝 `src/cascadia/TerminalApp/TabBase.cpp` (+1 -1) 📝 `src/cascadia/TerminalApp/TabBase.h` (+1 -0) 📝 `src/cascadia/TerminalApp/TabManagement.cpp` (+35 -27) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+19 -2) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+4 -2) 📝 `src/cascadia/TerminalApp/TerminalTab.cpp` (+1 -1) </details> ### 📄 Description ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:23:10 +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#27632