[PR #19024] Manually focus panes after swapping them #31679

Open
opened 2026-01-31 09:48:48 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/19024

State: closed
Merged: Yes


Summary of the Pull Request

Fixes a bug where the swap panes action would result in no content being focused!

The root cause of this bug was that in Pane::SwapPanes(), we would do the following:

if (const auto focus = first->GetActivePane())
   focus->_Focus();

However, _Focus would exit early if the pane was _lastActive, which was always the case because GetActivePane() would retrieve the _lastActive pane!

To fix this, we just manually focus the pane and its content.

Closes #18184

Validation Steps Performed

  1. Split pane (type content in them to more easily differentiate them)
  2. Swap panes
  3. Focus is on the same pane content as before (which should now be in a different position)
**Original Pull Request:** https://github.com/microsoft/terminal/pull/19024 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request Fixes a bug where the swap panes action would result in no content being focused! The root cause of this bug was that in `Pane::SwapPanes()`, we would do the following: ``` if (const auto focus = first->GetActivePane()) focus->_Focus(); ``` However, `_Focus` would exit early if the pane was `_lastActive`, which was always the case because `GetActivePane()` would retrieve the `_lastActive` pane! To fix this, we just manually focus the pane and its content. Closes #18184 ## Validation Steps Performed 1. Split pane (type content in them to more easily differentiate them) 2. Swap panes 3. ✅ Focus is on the same pane content as before (which should now be in a different position)
claunia added the pull-request label 2026-01-31 09:48:48 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31679