Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the cmdpal narrator message to include the number of results. #12429

Merged
4 commits merged into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/cascadia/TerminalApp/CommandPalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,10 +824,16 @@ 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 ? RS_(L"CommandPalette_MatchesAvailable") : NoMatchesText(), // 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_OneMatchAvailable")) :
NoMatchesText(), // what to announce if results were found
L"CommandPaletteResultAnnouncement" /* unique name for this group of notifications */);
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/cascadia/TerminalApp/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,11 @@
<value>Open Settings</value>
<comment>This is a call-to-action hyperlink; it will open the settings.</comment>
</data>
<data name="CommandPalette_MatchesAvailable" xml:space="preserve">
<value>Suggestions available</value>
<data name="CommandPalette_OneMatchAvailable" xml:space="preserve">
<value>One suggestion available</value>
</data>
</root>
<data name="CommandPalette_ManyMatchesAvailable" xml:space="preserve">
<value>{0} suggestions available</value>
<comment>{0} will be replaced with a number bigger than 1</comment>
</data>
</root>