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

Open
opened 2026-01-30 23:31:29 +00:00 by claunia · 0 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:29 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3848