[PR #14851] Introduce a ContentManager helper #30278

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

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

State: closed
Merged: Yes


Summary

Thus we come to the introduction of a new servant, the ContentManager, a singular entity that serves at the behest of the emperor. It is its charge to keep track of all TermControl instances created by the windows, for each window must seek its blessing before calling forth such an instance.
With the aid of the ContentManager, the TermControl shall now be traced by the hand of fate through the use of unique identifying marks, known as GUIDs. Yet, its purpose remains yet unknown, for it is merely a waypoint upon the journey yet to come.
This act of bridging also brings a change to the handling of events within the TermControl. This change shall see the addition of a revoker, similar to the manner in which the AppHost hath employed it, to the TermControl. Additionally, there is a new layer of indirection between the ControlCore and the App layer, making ready for the day when the TermControl may be repositioned and re-parented with ease.
Consider this but a trivial act, a mere shadow of things yet to come, for its impact shall be felt but briefly, like the passing of a gentle breeze.

Related to #5000
Related to #1256

Detailed description

This PR is another small bridge PR between the big work in #14843, and the PR that will enable panes to move between windows.

This introduces a new class, called ContentManager. This is a global singleton object, owned by the emperor. Whenever a window wants to instantiate a new TermControl, it must ask the ContentManager to give it one. This allows the ContentManager to track each "content" by GUID. That's it. We don't do anything with them in this PR by itself, we just track them.

This also includes a small change to the way TermControl events are handled. It adds an AppHost-like revoker struct, and weak_ref's all the handlers. We also add a layer of indirection between the ControlCore's raising of events and the App layer's handling. This will make reparenting content easier in the future.

This is a pretty trivial change which shouldn't have any major side effects. Consider it exposition of the things to come. It's intentionally small to try and keep the reviews more managable.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/14851 **State:** closed **Merged:** Yes --- ## Summary _Thus we come to the introduction of a new servant, the `ContentManager`, a singular entity that serves at the behest of the `emperor`. It is its charge to keep track of all `TermControl` instances created by the windows, for each window must seek its blessing before calling forth such an instance._ _With the aid of the `ContentManager`, the `TermControl` shall now be traced by the hand of fate through the use of unique identifying marks, known as `GUID`s. Yet, its purpose remains yet unknown, for it is merely a waypoint upon the journey yet to come._ _This act of bridging also brings a change to the handling of events within the `TermControl`. This change shall see the addition of a revoker, similar to the manner in which the `AppHost` hath employed it, to the `TermControl`. Additionally, there is a new layer of indirection between the `ControlCore` and the `App` layer, making ready for the day when the `TermControl` may be repositioned and re-parented with ease._ _Consider this but a trivial act, a mere shadow of things yet to come, for its impact shall be felt but briefly, like the passing of a gentle breeze._ Related to #5000 Related to #1256 # Detailed description This PR is another small bridge PR between the big work in #14843, and the PR that will enable panes to move between windows. This introduces a new class, called `ContentManager`. This is a global singleton object, owned by the emperor. Whenever a window wants to instantiate a new `TermControl`, it must ask the ContentManager to give it one. This allows the ContentManager to track each "content" by GUID. That's it. We don't do anything with them in this PR by itself, we just track them. This also includes a small change to the way TermControl events are handled. It adds an `AppHost`-like revoker struct, and weak_ref's all the handlers. We also add a layer of indirection between the ControlCore's raising of events and the App layer's handling. This will make reparenting content easier in the future. This is a pretty trivial change which shouldn't have any major side effects. Consider it exposition of the things to come. It's intentionally small to try and keep the reviews more managable.
claunia added the pull-request label 2026-01-31 09:39:44 +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#30278