_tabView.Items() and _tabs should not need to be kept in sync manually #3851

Closed
opened 2026-01-30 23:31:36 +00:00 by claunia · 2 comments
Owner

Originally created by @zadjii-msft on GitHub (Sep 12, 2019).

Originally assigned to: @leonMSFT on GitHub.

Right now in TerminalPage, we have two separate vectors of "tabs" that need to be kept in sync:

  1. Our own vector<shared_ptr<Tab>> _tabs
  2. The vector owned by _tabView of all the TabViewItems.

This is kinda silly, we should probably just use the _tabView.Items() vector, and more closely associate the Tab with them.

Case in point is TerminalPage::_RemoveTabViewItem, where we need to both remove the tab from both the tabs and the tabView.Items().

We could probably make tabs an observable vector or something, so the tabview is inherently tied to the tabs collection. I did a bit of similar prototyping in the command palette prototype, see #2046 for that branch.

Originally created by @zadjii-msft on GitHub (Sep 12, 2019). Originally assigned to: @leonMSFT on GitHub. Right now in TerminalPage, we have two separate vectors of "tabs" that need to be kept in sync: 1. Our own `vector<shared_ptr<Tab>> _tabs` 2. The vector owned by `_tabView` of all the `TabViewItem`s. This is kinda silly, we should probably just use the `_tabView.Items()` vector, and more closely associate the `Tab` with them. Case in point is `TerminalPage::_RemoveTabViewItem`, where we need to both remove the tab from both the tabs and the tabView.Items(). We could probably make tabs an observable vector or something, so the tabview is inherently tied to the tabs collection. I did a bit of similar prototyping in the command palette prototype, see #2046 for that branch.
claunia added the Issue-TaskNeeds-Tag-FixProduct-TerminalArea-CodeHealth labels 2026-01-30 23:31:36 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Sep 14, 2019):

yes please! If we make Tab a WinRT runtime class or something, we can probably even use it as the TabView Item.

@DHowett-MSFT commented on GitHub (Sep 14, 2019): _yes please_! If we make Tab a WinRT runtime class or something, we can probably even use it _as_ the TabView Item.
Author
Owner

@leonMSFT commented on GitHub (Jun 22, 2020):

Closing because we actually need access to the TabViewItem to perform some of our custom modifications like tab color and tab title boxes (and maybe future modifications), and so letting us have total control of our TabViewItems is needed, so this in fact is the way

@leonMSFT commented on GitHub (Jun 22, 2020): Closing because we actually need access to the TabViewItem to perform some of our custom modifications like tab color and tab title boxes (and maybe future modifications), and so letting us have total control of our TabViewItems is needed, so this in fact is the way
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3851