Manually focus panes after swapping them (#19024)

This commit is contained in:
Carlos Zamora 2025-06-13 15:43:13 -07:00 committed by GitHub
parent bb62ce9345
commit bd7e3179ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -697,12 +697,24 @@ bool Pane::SwapPanes(std::shared_ptr<Pane> first, std::shared_ptr<Pane> second)
// Refocus the last pane if there was a pane focused
if (const auto focus = first->GetActivePane())
{
focus->_Focus();
// GH#18184: manually focus the pane and content.
// _Focus() results in no-op because the pane was _lastActive
focus->GotFocus.raise(focus, FocusState::Programmatic);
if (const auto& lastContent{ focus->GetLastFocusedContent() })
{
lastContent.Focus(FocusState::Programmatic);
}
}
if (const auto focus = second->GetActivePane())
{
focus->_Focus();
// GH#18184: manually focus the pane and content.
// _Focus() results in no-op because the pane was _lastActive
focus->GotFocus.raise(focus, FocusState::Programmatic);
if (const auto& lastContent{ focus->GetLastFocusedContent() })
{
lastContent.Focus(FocusState::Programmatic);
}
}
return true;