Repository navigation
Conversation
Capture global focus immediately before a sidebar swap and restore it only when the new sidebar remains focused. Prefer that pane over the background workspace pane displaced by the swap, while preserving intentional later focus changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A background
worktree open --no-focuscan still switch the user into the new workspace when the automatic sidebar hook docks:pane.swapfocuses the new sidebar. The prior repair picked the pane displaced by the swap, which belongs to the background workspace, instead of the globally focused pane.Fix
Capture the focused pane immediately before
pane.swap, then restore it only if the newly docked sidebar remains focused. Fall back to the entry snapshot when the fresh read fails, or to the displaced pane when there is no recorded focus. Explicit user focus changes after docking still win. Extend the existing focus regression for a background workspace, same-tab docking, and missing prior focus; document the host behavior inAGENTS.md.Validation
w2:p1instead ofw1:p1; passes after fix.cargo test -- --test-threads=1: 390 passed, 3 ignored.cargo clippy --all-targets -- -D warnings,cargo fmt --check,git diff --check: passed.gating=0; six minor findings (including two verbosity findings).