Skip to content

Manually focus panes after swapping them #19024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

carlos-zamora
Copy link
Member

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)

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, interesting! Good fix

@github-project-automation github-project-automation bot moved this to To Cherry Pick in 1.22 Servicing Pipeline Jun 13, 2025
@github-project-automation github-project-automation bot moved this to To Cherry Pick in 1.23 Servicing Pipeline Jun 13, 2025
@DHowett DHowett merged commit bd7e317 into main Jun 13, 2025
19 checks passed
@DHowett DHowett deleted the dev/cazamor/bugfix/swap-panes-focus branch June 13, 2025 22:43
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.22 Servicing Pipeline Jun 17, 2025
DHowett pushed a commit that referenced this pull request Jun 17, 2025
(cherry picked from commit bd7e317)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgbeR18
Service-Version: 1.22
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.23 Servicing Pipeline Jun 17, 2025
DHowett pushed a commit that referenced this pull request Jun 17, 2025
(cherry picked from commit bd7e317)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgbeR2A
Service-Version: 1.23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Cherry Picked
Status: Cherry Picked
Development

Successfully merging this pull request may close these issues.

Pane focus is lost after pane swap
2 participants