fix announcement for duplicate tab/pane

This commit is contained in:
Carlos Zamora
2022-07-25 10:27:57 -07:00
parent 2cb1ff753f
commit 0473430282
2 changed files with 18 additions and 11 deletions

View File

@@ -747,9 +747,11 @@
<comment>{0} will be replaced with a number.</comment>
</data>
<data name="NewTabAnnouncement" xml:space="preserve">
<value>{} profile tab created successfully</value>
<value>A new tab for the "{}" profile was created successfully</value>
<comment>{} will be replaced with the name of the profile (i.e. PowerShell, Command Prompt, etc.). The name may span multiple words. This announcement is read by a screen reader.</comment>
</data>
<data name="SplitPaneAnnouncement" xml:space="preserve">
<value>{} profile pane created successfully</value>
<value>A new pane for the "{}" profile was created successfully</value>
<comment>{} will be replaced with the name of the profile (i.e. PowerShell, Command Prompt, etc.). The name may span multiple words. This announcement is read by a screen reader.</comment>
</data>
</root>

View File

@@ -87,15 +87,6 @@ namespace winrt::TerminalApp::implementation
// case above with the _maybeElevate call.
_CreateNewTabFromPane(_MakePane(newTerminalArgs, false, existingConnection));
if (_autoPeer)
{
_autoPeer.RaiseNotificationEvent(
Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
fmt::format(std::wstring_view{ RS_(L"NewTabAnnouncement") }, settings.DefaultSettings().ProfileName()),
L"NewTab" /* unique name for this notification category */);
}
const auto tabCount = _tabs.Size();
const auto usedManualProfile = (newTerminalArgs != nullptr) &&
(newTerminalArgs.ProfileIndex() != nullptr ||
@@ -297,6 +288,20 @@ namespace winrt::TerminalApp::implementation
{
auto newTabImpl = winrt::make_self<TerminalTab>(pane);
_InitializeTab(newTabImpl);
if (_autoPeer)
{
// we can't check if this is a leaf pane,
// but getting the profile returns null if we aren't, so that works!
if (const auto profile{ pane->GetProfile() })
{
_autoPeer.RaiseNotificationEvent(
Automation::Peers::AutomationNotificationKind::ActionCompleted,
Automation::Peers::AutomationNotificationProcessing::ImportantMostRecent,
fmt::format(std::wstring_view{ RS_(L"NewTabAnnouncement") }, profile.Name()),
L"NewTab" /* unique name for this notification category */);
}
}
}
}