From c41a7bde2a51ffd699e240e2814b70d835337b48 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Tue, 8 Feb 2022 09:00:20 -0600 Subject: [PATCH 1/4] this works --- src/cascadia/TerminalApp/CommandPalette.cpp | 9 ++++++++- src/cascadia/TerminalApp/Resources/en-US/Resources.resw | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp index 10578822c1e..f1c87d1f794 100644 --- a/src/cascadia/TerminalApp/CommandPalette.cpp +++ b/src/cascadia/TerminalApp/CommandPalette.cpp @@ -824,10 +824,17 @@ namespace winrt::TerminalApp::implementation _noMatchesText().Visibility(currentNeedleHasResults ? Visibility::Collapsed : Visibility::Visible); if (auto automationPeer{ Automation::Peers::FrameworkElementAutomationPeer::FromElement(_searchBox()) }) { + const bool hasMultipleMatches{ _filteredActions.Size() > 1 }; + const auto message{ currentNeedleHasResults ? + (hasMultipleMatches ? + winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"CommandPalette_ManyMatchesAvailable") }, _filteredActions.Size()) } : + RS_(L"CommandPalette_OneMatcheAvailable")) : + NoMatchesText() }; + automationPeer.RaiseNotificationEvent( Automation::Peers::AutomationNotificationKind::ActionCompleted, Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, - currentNeedleHasResults ? RS_(L"CommandPalette_MatchesAvailable") : NoMatchesText(), // what to announce if results were found + message, // what to announce if results were found L"CommandPaletteResultAnnouncement" /* unique name for this group of notifications */); } } diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw index 20efc069221..8a1231f479b 100644 --- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw @@ -731,4 +731,11 @@ Suggestions available - \ No newline at end of file + + One suggestion available + + + {0} suggestions available + {0} + + From 9bd889106a54ede9a030b3288b6c9432c4175d0e Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Tue, 8 Feb 2022 09:05:37 -0600 Subject: [PATCH 2/4] cleanup --- src/cascadia/TerminalApp/CommandPalette.cpp | 11 +++++------ .../TerminalApp/Resources/en-US/Resources.resw | 5 +---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp index f1c87d1f794..a825b6c8987 100644 --- a/src/cascadia/TerminalApp/CommandPalette.cpp +++ b/src/cascadia/TerminalApp/CommandPalette.cpp @@ -825,16 +825,15 @@ namespace winrt::TerminalApp::implementation if (auto automationPeer{ Automation::Peers::FrameworkElementAutomationPeer::FromElement(_searchBox()) }) { const bool hasMultipleMatches{ _filteredActions.Size() > 1 }; - const auto message{ currentNeedleHasResults ? - (hasMultipleMatches ? - winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"CommandPalette_ManyMatchesAvailable") }, _filteredActions.Size()) } : - RS_(L"CommandPalette_OneMatcheAvailable")) : - NoMatchesText() }; automationPeer.RaiseNotificationEvent( Automation::Peers::AutomationNotificationKind::ActionCompleted, Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, - message, // what to announce if results were found + currentNeedleHasResults ? + (hasMultipleMatches ? + winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"CommandPalette_ManyMatchesAvailable") }, _filteredActions.Size()) } : + RS_(L"CommandPalette_OneMatcheAvailable")) : + NoMatchesText(), // what to announce if results were found L"CommandPaletteResultAnnouncement" /* unique name for this group of notifications */); } } diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw index 8a1231f479b..800883bc8c7 100644 --- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw @@ -728,14 +728,11 @@ Open Settings This is a call-to-action hyperlink; it will open the settings. - - Suggestions available - One suggestion available {0} suggestions available - {0} + {0} will be replaced with a number bigger than 1 From 54007c172bef3ec589dfe82e671cfae97d00526b Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Tue, 8 Feb 2022 09:11:51 -0600 Subject: [PATCH 3/4] spel is hard --- src/cascadia/TerminalApp/CommandPalette.cpp | 2 +- src/cascadia/TerminalApp/Resources/en-US/Resources.resw | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp index a825b6c8987..05337bc7137 100644 --- a/src/cascadia/TerminalApp/CommandPalette.cpp +++ b/src/cascadia/TerminalApp/CommandPalette.cpp @@ -832,7 +832,7 @@ namespace winrt::TerminalApp::implementation currentNeedleHasResults ? (hasMultipleMatches ? winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"CommandPalette_ManyMatchesAvailable") }, _filteredActions.Size()) } : - RS_(L"CommandPalette_OneMatcheAvailable")) : + RS_(L"CommandPalette_OneMatchAvailable")) : NoMatchesText(), // what to announce if results were found L"CommandPaletteResultAnnouncement" /* unique name for this group of notifications */); } diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw index 800883bc8c7..911b203a303 100644 --- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw @@ -728,7 +728,7 @@ Open Settings This is a call-to-action hyperlink; it will open the settings. - + One suggestion available From 4c0e6cc8659da0d14a0a28a66dd3c84b054e7998 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Tue, 8 Feb 2022 16:59:09 -0600 Subject: [PATCH 4/4] This seems like a good enough work around for now --- src/cascadia/TerminalApp/CommandPalette.cpp | 6 +----- src/cascadia/TerminalApp/Resources/en-US/Resources.resw | 9 +++------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/cascadia/TerminalApp/CommandPalette.cpp b/src/cascadia/TerminalApp/CommandPalette.cpp index 05337bc7137..382e599ac35 100644 --- a/src/cascadia/TerminalApp/CommandPalette.cpp +++ b/src/cascadia/TerminalApp/CommandPalette.cpp @@ -824,15 +824,11 @@ namespace winrt::TerminalApp::implementation _noMatchesText().Visibility(currentNeedleHasResults ? Visibility::Collapsed : Visibility::Visible); if (auto automationPeer{ Automation::Peers::FrameworkElementAutomationPeer::FromElement(_searchBox()) }) { - const bool hasMultipleMatches{ _filteredActions.Size() > 1 }; - automationPeer.RaiseNotificationEvent( Automation::Peers::AutomationNotificationKind::ActionCompleted, Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent, currentNeedleHasResults ? - (hasMultipleMatches ? - winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"CommandPalette_ManyMatchesAvailable") }, _filteredActions.Size()) } : - RS_(L"CommandPalette_OneMatchAvailable")) : + winrt::hstring{ fmt::format(std::wstring_view{ RS_(L"CommandPalette_MatchesAvailable") }, _filteredActions.Size()) } : NoMatchesText(), // what to announce if results were found L"CommandPaletteResultAnnouncement" /* unique name for this group of notifications */); } diff --git a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw index 911b203a303..b2133af1816 100644 --- a/src/cascadia/TerminalApp/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalApp/Resources/en-US/Resources.resw @@ -728,11 +728,8 @@ Open Settings This is a call-to-action hyperlink; it will open the settings. - - One suggestion available - - - {0} suggestions available - {0} will be replaced with a number bigger than 1 + + Suggestions found: {0} + {0} will be replaced with a number.