From aea4c15bd6605dd4fdf170038403a2d06d5e2897 Mon Sep 17 00:00:00 2001 From: nogunumo Date: Fri, 4 Dec 2020 17:47:49 +0900 Subject: [PATCH 1/8] update for TabHeaderControl --- src/cascadia/TerminalApp/TerminalTab.cpp | 12 ++++++++++++ src/cascadia/TerminalApp/TerminalTab.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index e50c5de89e0..7c8b739f621 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -71,6 +71,17 @@ namespace winrt::TerminalApp::implementation _RecalculateAndApplyTabColor(); } + void TerminalTab::_SetToolTip(const winrt::hstring& tabTitle) + { + auto toolTip = WUX::Controls::ToolTip{}; + auto newTabRun = WUX::Documents::Run(); + newTabRun.Text(tabTitle); + auto textBlock = WUX::Controls::TextBlock{}; + textBlock.Inlines().Append(newTabRun); + toolTip.Content(textBlock); + 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 @@ -231,6 +242,7 @@ namespace winrt::TerminalApp::implementation // Update the control to reflect the changed title _headerControl.Title(activeTitle); + _SetToolTip(_GetActiveTitle()); } } diff --git a/src/cascadia/TerminalApp/TerminalTab.h b/src/cascadia/TerminalApp/TerminalTab.h index b228b45a1de..2b1efd3bab0 100644 --- a/src/cascadia/TerminalApp/TerminalTab.h +++ b/src/cascadia/TerminalApp/TerminalTab.h @@ -93,6 +93,8 @@ namespace winrt::TerminalApp::implementation void _MakeTabViewItem(); + void _SetToolTip(const winrt::hstring& tabTitle); + void _CreateContextMenu() override; void _RefreshVisualState(); From 96da7f8b688213faee78fe205c9cb8d4ad9be23b Mon Sep 17 00:00:00 2001 From: nogunumo Date: Fri, 4 Dec 2020 17:50:39 +0900 Subject: [PATCH 2/8] delete the line from last the PR(8194) --- src/cascadia/TerminalApp/CommandPalette.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp index 90c1f7f95c1..83f4114c8ea 100644 --- a/src/cascadia/TerminalApp/CommandPalette.cpp +++ b/src/cascadia/TerminalApp/CommandPalette.cpp @@ -290,8 +290,7 @@ namespace winrt::TerminalApp::implementation Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e) { auto key = e.OriginalKey(); - auto const ctrlDown = WI_IsFlagSet(CoreWindow::GetForCurrentThread().GetKeyState(winrt::Windows::System::VirtualKey::Control), CoreVirtualKeyStates::Down); - + if (key == VirtualKey::Up) { // Action Mode: Move focus to the next item in the list. From 127eeb13607e4848c3bcfac7098d763d6f8994e8 Mon Sep 17 00:00:00 2001 From: nogunumo Date: Fri, 4 Dec 2020 18:44:00 +0900 Subject: [PATCH 3/8] code format --- src/cascadia/TerminalApp/CommandPalette.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp index 83f4114c8ea..993378eacbd 100644 --- a/src/cascadia/TerminalApp/CommandPalette.cpp +++ b/src/cascadia/TerminalApp/CommandPalette.cpp @@ -290,7 +290,7 @@ namespace winrt::TerminalApp::implementation Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e) { auto key = e.OriginalKey(); - + if (key == VirtualKey::Up) { // Action Mode: Move focus to the next item in the list. From 96e77bb2892c3ef4223b837ebfd9dda6dc07428e Mon Sep 17 00:00:00 2001 From: nogunumo Date: Tue, 15 Dec 2020 18:08:39 +0900 Subject: [PATCH 4/8] avoid the Run and TextBlock --- src/cascadia/TerminalApp/TerminalTab.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index 7c8b739f621..ab739750035 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -48,6 +48,7 @@ namespace winrt::TerminalApp::implementation // Use our header control as the TabViewItem's header TabViewItem().Header(_headerControl); + } // Method Description: @@ -74,11 +75,7 @@ namespace winrt::TerminalApp::implementation void TerminalTab::_SetToolTip(const winrt::hstring& tabTitle) { auto toolTip = WUX::Controls::ToolTip{}; - auto newTabRun = WUX::Documents::Run(); - newTabRun.Text(tabTitle); - auto textBlock = WUX::Controls::TextBlock{}; - textBlock.Inlines().Append(newTabRun); - toolTip.Content(textBlock); + toolTip.Content(winrt::box_value(tabTitle)); WUX::Controls::ToolTipService::SetToolTip(TabViewItem(), toolTip); } From 7a73a8fbb4d5cd1935f009a5a1e66ca2dc861236 Mon Sep 17 00:00:00 2001 From: nogunumo Date: Tue, 15 Dec 2020 18:13:37 +0900 Subject: [PATCH 5/8] not this PR --- src/cascadia/TerminalApp/CommandPalette.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp index 993378eacbd..90c1f7f95c1 100644 --- a/src/cascadia/TerminalApp/CommandPalette.cpp +++ b/src/cascadia/TerminalApp/CommandPalette.cpp @@ -290,6 +290,7 @@ namespace winrt::TerminalApp::implementation Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e) { auto key = e.OriginalKey(); + auto const ctrlDown = WI_IsFlagSet(CoreWindow::GetForCurrentThread().GetKeyState(winrt::Windows::System::VirtualKey::Control), CoreVirtualKeyStates::Down); if (key == VirtualKey::Up) { From 9eba42801c683907617e1aa1a79930316e7ed7ec Mon Sep 17 00:00:00 2001 From: nogunumo Date: Tue, 15 Dec 2020 23:24:46 +0900 Subject: [PATCH 6/8] remove _SetToolTip from UpdateTitle() --- src/cascadia/TerminalApp/TerminalTab.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index ab739750035..d2bed45072c 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -45,10 +45,9 @@ namespace winrt::TerminalApp::implementation tab->SetTabText(title); } }); - // Use our header control as the TabViewItem's header TabViewItem().Header(_headerControl); - + _SetToolTip(_GetActiveTitle()); } // Method Description: @@ -239,7 +238,6 @@ namespace winrt::TerminalApp::implementation // Update the control to reflect the changed title _headerControl.Title(activeTitle); - _SetToolTip(_GetActiveTitle()); } } @@ -297,6 +295,7 @@ namespace winrt::TerminalApp::implementation // possible that the focus events won't propagate immediately. Updating // the focus here will give the same effect though. _UpdateActivePane(second); + _SetToolTip(_GetActiveTitle()); } // Method Description: From dffe5603c127fd3a2c69bf2953131225a8a4ce3b Mon Sep 17 00:00:00 2001 From: nogunumo Date: Wed, 16 Dec 2020 06:00:44 +0900 Subject: [PATCH 7/8] Put it back into UpdateTitle() --- src/cascadia/TerminalApp/TerminalTab.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index d2bed45072c..331ac2b25d2 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -47,7 +47,6 @@ namespace winrt::TerminalApp::implementation }); // Use our header control as the TabViewItem's header TabViewItem().Header(_headerControl); - _SetToolTip(_GetActiveTitle()); } // Method Description: @@ -238,6 +237,7 @@ namespace winrt::TerminalApp::implementation // Update the control to reflect the changed title _headerControl.Title(activeTitle); + _SetToolTip(activeTitle); } } @@ -295,7 +295,6 @@ namespace winrt::TerminalApp::implementation // possible that the focus events won't propagate immediately. Updating // the focus here will give the same effect though. _UpdateActivePane(second); - _SetToolTip(_GetActiveTitle()); } // Method Description: From 52517c4e809ad68f2c9ac1119b56785c05c0a283 Mon Sep 17 00:00:00 2001 From: nogunumo Date: Thu, 17 Dec 2020 15:11:12 +0900 Subject: [PATCH 8/8] improve readability --- src/cascadia/TerminalApp/TerminalTab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index 331ac2b25d2..5f3363602d3 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -72,7 +72,7 @@ namespace winrt::TerminalApp::implementation void TerminalTab::_SetToolTip(const winrt::hstring& tabTitle) { - auto toolTip = WUX::Controls::ToolTip{}; + WUX::Controls::ToolTip toolTip{}; toolTip.Content(winrt::box_value(tabTitle)); WUX::Controls::ToolTipService::SetToolTip(TabViewItem(), toolTip); }