Skip to content

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

@zadjii-msft

Description

@zadjii-msft

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.

Metadata

Metadata

Assignees

Labels

Area-CodeHealthIssues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc.Issue-TaskIt's a feature request, but it doesn't really need a major design.Needs-Tag-FixDoesn't match tag requirementsProduct-TerminalThe new Windows Terminal.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions