[PR #4350] [MERGED] Convert Tab to a WinRT type #25716

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/4350
Author: @leonMSFT
Created: 1/24/2020
Status: ✅ Merged
Merged: 2/4/2020
Merged by: @undefined

Base: master ← Head: dev/lelian/WinRTTab


📝 Commits (10+)

  • b9fa082 Tab is now a WinRT type, changed its shared_ptr self calls to get_weaks
  • ae2b0d5 changed test case to use com_ptr outside the lambda to heed the warning
  • b132475 added a comment to the observable getset property macro
  • 1afe573 modified TerminalPage to use an ObservableVector of WinRT tabs
  • 5718127 changing macro name, using winrt_callback macro, and changing RegisterTerminalEvents signature
  • 7aaed78 resolving merge conflicts
  • f608b3c formatting
  • 516c0de fixing build errors
  • 091d953 incorporating PR comments
  • ff8ed26 moving this const cast magic into a macro magic

📊 Changes

13 files changed (+634 additions, -487 deletions)

View changed files

📝 src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp (+1 -1)
📝 src/cascadia/LocalTests_TerminalApp/TabTests.cpp (+3 -3)
📝 src/cascadia/TerminalApp/ActionArgs.h (+2 -2)
📝 src/cascadia/TerminalApp/ActionArgs.idl (+1 -1)
📝 src/cascadia/TerminalApp/Tab.cpp (+359 -328)
📝 src/cascadia/TerminalApp/Tab.h (+46 -37)
➕ src/cascadia/TerminalApp/Tab.idl (+11 -0)
📝 src/cascadia/TerminalApp/TerminalApp.vcxproj (+1 -0)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+172 -105)
📝 src/cascadia/TerminalApp/TerminalPage.h (+9 -7)
📝 src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj (+8 -3)
📝 src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj.filters (+3 -0)
📝 src/cascadia/inc/cppwinrt_utils.h (+18 -0)

📄 Description

Summary of the Pull Request

This PR will make the existing Tab class into a WinRT type. This will allow any XAML to simply bind to the ObservableVector of Tabs.

This PR will be followed up with a future PR to change our TabView to use the ObservableVector, which will in turn eliminate the need for maintaining two vectors of Tabs. (We currently maintain _tabs in TerminalPage and we also maintain TabView().TabViewItems() at the same time as described here: #2740)

References

#3922

PR Checklist

  • CLA signed.
  • Tests added/passed

Detailed Description of the Pull Request / Additional comments

I've currently only exposed a Tab's Title and IconPath to keep things simple. I foresee XAML elements that bind to Tabs to only really need these two properties for displaying.

I've also converted TerminalPage's std::vector<std::shared_ptr> _tabs into a IObservableVector<winrt::TerminalPage::Tab> _tabs just so that future PRs will have the ground set for binding to this vector of tabs.

Validation Steps Performed

Played around with Tabs and Panes and all sorts of combinations of keybindings for interacting with tabs and dragging and whatnot, it all seemed fine! Tab Tests also all pass.


🔄 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/4350 **Author:** [@leonMSFT](https://github.com/leonMSFT) **Created:** 1/24/2020 **Status:** ✅ Merged **Merged:** 2/4/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/lelian/WinRTTab` --- ### 📝 Commits (10+) - [`b9fa082`](https://github.com/microsoft/terminal/commit/b9fa082138148585c206f37bac30a2c2d2768c94) Tab is now a WinRT type, changed its shared_ptr self calls to get_weaks - [`ae2b0d5`](https://github.com/microsoft/terminal/commit/ae2b0d5baacf3d8ded2be5a8988259108d8b6cc6) changed test case to use com_ptr outside the lambda to heed the warning - [`b132475`](https://github.com/microsoft/terminal/commit/b1324751d255258c43b6563ed058176733fe7ef2) added a comment to the observable getset property macro - [`1afe573`](https://github.com/microsoft/terminal/commit/1afe573f0dda6a364b753b997d8099bc447a795c) modified TerminalPage to use an ObservableVector of WinRT tabs - [`5718127`](https://github.com/microsoft/terminal/commit/571812798e47b71e9a4e1f6b8126dc868fd78418) changing macro name, using winrt_callback macro, and changing RegisterTerminalEvents signature - [`7aaed78`](https://github.com/microsoft/terminal/commit/7aaed78ef53e336066a165b880571667b79d6c4c) resolving merge conflicts - [`f608b3c`](https://github.com/microsoft/terminal/commit/f608b3cf2c5f6049d311e5f10455a5cd9ee1df7a) formatting - [`516c0de`](https://github.com/microsoft/terminal/commit/516c0deab719dbc049d9a43aff3114eaa0f5967e) fixing build errors - [`091d953`](https://github.com/microsoft/terminal/commit/091d95308baa32c89cd572051b13ccf0b541e0d2) incorporating PR comments - [`ff8ed26`](https://github.com/microsoft/terminal/commit/ff8ed261b014d67120ef79fca6bfd8e382a83d32) moving this const cast magic into a macro magic ### 📊 Changes **13 files changed** (+634 additions, -487 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp` (+1 -1) 📝 `src/cascadia/LocalTests_TerminalApp/TabTests.cpp` (+3 -3) 📝 `src/cascadia/TerminalApp/ActionArgs.h` (+2 -2) 📝 `src/cascadia/TerminalApp/ActionArgs.idl` (+1 -1) 📝 `src/cascadia/TerminalApp/Tab.cpp` (+359 -328) 📝 `src/cascadia/TerminalApp/Tab.h` (+46 -37) ➕ `src/cascadia/TerminalApp/Tab.idl` (+11 -0) 📝 `src/cascadia/TerminalApp/TerminalApp.vcxproj` (+1 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+172 -105) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+9 -7) 📝 `src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj` (+8 -3) 📝 `src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj.filters` (+3 -0) 📝 `src/cascadia/inc/cppwinrt_utils.h` (+18 -0) </details> ### 📄 Description ## Summary of the Pull Request This PR will make the existing `Tab` class into a WinRT type. This will allow any XAML to simply bind to the `ObservableVector` of Tabs. This PR will be followed up with a future PR to change our TabView to use the ObservableVector, which will in turn eliminate the need for maintaining two vectors of Tabs. (We currently maintain `_tabs` in `TerminalPage` and we also maintain `TabView().TabViewItems()` at the same time as described here: #2740) ## References #3922 ## PR Checklist * [x] CLA signed. * [x] Tests added/passed ## Detailed Description of the Pull Request / Additional comments I've currently only exposed a Tab's Title and IconPath to keep things simple. I foresee XAML elements that bind to Tabs to only really need these two properties for displaying. I've also converted `TerminalPage`'s `std::vector<std::shared_ptr> _tabs` into a `IObservableVector<winrt::TerminalPage::Tab> _tabs` just so that future PRs will have the ground set for binding to this vector of tabs. ## Validation Steps Performed Played around with Tabs and Panes and all sorts of combinations of keybindings for interacting with tabs and dragging and whatnot, it all seemed fine! Tab Tests also all pass. --- <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:11:20 +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#25716