General cleanup: fix some comments, use new convenient method.

This commit is contained in:
Schuyler Rosefield 2021-09-06 17:32:15 -04:00
parent d20ce765fb
commit 200bee1317
2 changed files with 5 additions and 13 deletions

View file

@ -1090,7 +1090,7 @@ std::shared_ptr<Pane> Pane::GetActivePane()
// Arguments:
// - <none>
// Return Value:
// - nullptr if this Pane is a parent, otherwise the TermControl of this Pane.
// - nullptr if this Pane is an unfocused parent, otherwise the TermControl of this Pane.
TermControl Pane::GetLastFocusedTerminalControl()
{
if (!_IsLeaf())
@ -1129,7 +1129,6 @@ TermControl Pane::GetTerminalControl()
void Pane::ClearActive()
{
_lastActive = false;
if (!_IsLeaf())
{
_firstChild->ClearActive();
@ -1226,8 +1225,9 @@ void Pane::UpdateVisuals()
}
// Method Description:
// - Focus the current pane. Also trigger focus of the first-most child control
// to make sure that focus exists within the tab (since panes aren't proper controls)
// - Focus the current pane. Also trigger focus on the control, or if not a leaf
// the control belonging to the last focused leaf.
// This makes sure that focus exists within the tab (since panes aren't proper controls)
// Arguments:
// - <none>
// Return Value:

View file

@ -1004,21 +1004,13 @@ namespace winrt::TerminalApp::implementation
{
if (sender != tab->_activePane)
{
auto senderIsChild = tab->_activePane->WalkTree([&](auto pane) {
if (pane->_IsLeaf())
{
return false;
}
return pane->_firstChild == sender || pane->_secondChild == sender;
});
auto senderIsChild = tab->_activePane->_HasChild(sender);
// Only move focus if we the program moved focus, or the
// user moved with their mouse. This is a problem because a
// pane isn't a control itself, and if we have the parent
// focused we are fine if the terminal control is focused,
// but we don't want to update the active pane.
if (!senderIsChild ||
(focus == WUX::FocusState::Programmatic && tab->_changingActivePane) ||
focus == WUX::FocusState::Pointer)