Skip to content

Commit bd7e317

Browse files
Manually focus panes after swapping them (#19024)
1 parent bb62ce9 commit bd7e317

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/cascadia/TerminalApp/Pane.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,12 +697,24 @@ bool Pane::SwapPanes(std::shared_ptr<Pane> first, std::shared_ptr<Pane> second)
697697
// Refocus the last pane if there was a pane focused
698698
if (const auto focus = first->GetActivePane())
699699
{
700-
focus->_Focus();
700+
// GH#18184: manually focus the pane and content.
701+
// _Focus() results in no-op because the pane was _lastActive
702+
focus->GotFocus.raise(focus, FocusState::Programmatic);
703+
if (const auto& lastContent{ focus->GetLastFocusedContent() })
704+
{
705+
lastContent.Focus(FocusState::Programmatic);
706+
}
701707
}
702708

703709
if (const auto focus = second->GetActivePane())
704710
{
705-
focus->_Focus();
711+
// GH#18184: manually focus the pane and content.
712+
// _Focus() results in no-op because the pane was _lastActive
713+
focus->GotFocus.raise(focus, FocusState::Programmatic);
714+
if (const auto& lastContent{ focus->GetLastFocusedContent() })
715+
{
716+
lastContent.Focus(FocusState::Programmatic);
717+
}
706718
}
707719

708720
return true;

0 commit comments

Comments
 (0)