From b8e6b8e27c2c902ce18798904ce09ff32d2f68fd Mon Sep 17 00:00:00 2001 From: Kiminori Kaburagi Date: Thu, 17 Dec 2020 23:22:19 +0900 Subject: [PATCH] Set Tab tooltip explicitly (#8298) ## Summary of the Pull Request The tab tooltip is no longer empty when it was toggle zoomed. ## References ## PR Checklist * [x] Closes #8199 * [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema updated. * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed --- src/cascadia/TerminalApp/TerminalTab.cpp | 9 ++++++++- src/cascadia/TerminalApp/TerminalTab.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index 6d46d74215b..ff2c62e029e 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -50,7 +50,6 @@ namespace winrt::TerminalApp::implementation tab->SetTabText(title); } }); - // Use our header control as the TabViewItem's header TabViewItem().Header(_headerControl); } @@ -76,6 +75,13 @@ namespace winrt::TerminalApp::implementation _RecalculateAndApplyTabColor(); } + void TerminalTab::_SetToolTip(const winrt::hstring& tabTitle) + { + WUX::Controls::ToolTip toolTip{}; + toolTip.Content(winrt::box_value(tabTitle)); + WUX::Controls::ToolTipService::SetToolTip(TabViewItem(), toolTip); + } + // Method Description: // - Returns nullptr if no children of this tab were the last control to be // focused, or the TermControl that _was_ the last control to be focused (if @@ -265,6 +271,7 @@ namespace winrt::TerminalApp::implementation // Update the control to reflect the changed title _headerControl.Title(activeTitle); + _SetToolTip(activeTitle); } } diff --git a/src/cascadia/TerminalApp/TerminalTab.h b/src/cascadia/TerminalApp/TerminalTab.h index a4e1c6ef591..a2bfe9b2b05 100644 --- a/src/cascadia/TerminalApp/TerminalTab.h +++ b/src/cascadia/TerminalApp/TerminalTab.h @@ -98,6 +98,8 @@ namespace winrt::TerminalApp::implementation void _MakeTabViewItem(); + void _SetToolTip(const winrt::hstring& tabTitle); + void _CreateContextMenu() override; void _RefreshVisualState();