last pr nits
This commit is contained in:
parent
bdf08165d4
commit
3a8a83a810
|
@ -8,7 +8,6 @@
|
|||
#include "AdminWarningPlaceholder.g.cpp"
|
||||
#include <LibraryResources.h>
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
using namespace winrt::Windows::UI::Xaml::Automation::Peers;
|
||||
|
||||
namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
|
|
|
@ -1337,7 +1337,8 @@ TermControl Pane::GetLastFocusedTerminalControl()
|
|||
// TermControl of this Pane.
|
||||
TermControl Pane::GetTerminalControl() const
|
||||
{
|
||||
return _IsLeaf() ? _control.try_as<TermControl>() : nullptr;
|
||||
auto control{ GetUserControl() };
|
||||
return control ? control.try_as<TermControl>() : nullptr;
|
||||
}
|
||||
|
||||
Controls::UserControl Pane::GetUserControl() const
|
||||
|
@ -2554,7 +2555,7 @@ std::pair<std::shared_ptr<Pane>, std::shared_ptr<Pane>> Pane::_Split(SplitDirect
|
|||
_warningBellToken.value = 0;
|
||||
}
|
||||
|
||||
// Remove our old GotFocus handler from the control. We don't what the
|
||||
// Remove our old GotFocus handler from the control. We don't want the
|
||||
// control telling us that it's now focused, we want it telling its new
|
||||
// parent.
|
||||
_gotFocusRevoker.revoke();
|
||||
|
|
|
@ -1656,29 +1656,27 @@ namespace winrt::TerminalApp::implementation
|
|||
if (const auto& tabImpl{ _GetTerminalTabImpl(tab) })
|
||||
{
|
||||
tabImpl->GetRootPane()->WalkTree([warningControl, cmdline, tabImpl](std::shared_ptr<Pane> pane) -> bool {
|
||||
if (pane->GetUserControl() == *warningControl)
|
||||
const auto& projectedWarningControl{ pane->GetUserControl().try_as<TerminalApp::AdminWarningPlaceholder>() };
|
||||
// If it was a warning control, then get our implementation
|
||||
// type out of it.
|
||||
if (const auto& otherWarning{ winrt::get_self<AdminWarningPlaceholder>(projectedWarningControl) })
|
||||
{
|
||||
// Hooray, we found us!
|
||||
pane->ReplaceControl(warningControl->Control());
|
||||
// Update the title, because replacing the control like
|
||||
// this is a little weird, and doesn't actually trigger
|
||||
// a TitleChanged by itself.
|
||||
tabImpl->UpdateTitle();
|
||||
// Don't return true here. We want to make sure to check
|
||||
// all the panes for the same commandline we just
|
||||
// approved.
|
||||
}
|
||||
else if (const auto& otherWarning{ winrt::get_self<AdminWarningPlaceholder>(pane->GetUserControl().try_as<TerminalApp::AdminWarningPlaceholder>()) })
|
||||
{
|
||||
// This pane wasn't us, but it did have a warning in it.
|
||||
// This pane had a warning in it.
|
||||
// Was it a warning for the same commandline that we
|
||||
// just approved?
|
||||
if (otherWarning->Commandline() == cmdline)
|
||||
{
|
||||
// Go ahead and allow them as well.
|
||||
// Go ahead and allow them. Swap the control into
|
||||
// the pane, which will initialize and start it.
|
||||
pane->ReplaceControl(otherWarning->Control());
|
||||
// Update the title, because replacing the control like
|
||||
// this is a little weird, and doesn't actually trigger
|
||||
// a TitleChanged by itself.
|
||||
tabImpl->UpdateTitle();
|
||||
}
|
||||
// Don't return true here. We want to make sure to check
|
||||
// all the panes for the same commandline we just
|
||||
// approved.
|
||||
}
|
||||
// return false so we make sure to iterate on every leaf.
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue