Repository navigation
Conversation
Typing sometimes landed in a different pane than the highlighted one. ActiveSession drives the highlight, but keystrokes follow Win32 focus, and two paths let them drift apart: - Clicking a pane while CSM was in the background: OnWindowActivated BeginInvoked FocusTerminal on the PREVIOUS active session, racing the page's cross-process `activate` message. When it landed last, the highlight moved to the clicked pane and focus stayed on the old one. It now skips the refocus when a mouse button is down (the click picks the target), and a pane click both promotes and focuses its pane. - Restart restored ActiveSession to the revived session but never focused it, leaving focus wherever the teardown put it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Sometimes typing in a pane makes the letters appear in a different pane.
MainViewModel.ActiveSessiondrives the highlight, but keystrokes follow Win32 keyboard focus. Two paths let the two drift apart:OnWindowActivatedBeginInvokedFocusTerminal()on the previous active session. Meanwhile the page's capture-phasemousedownpostsactivate, a cross-process message, which promotes the clicked pane. Whichever lands last wins. When the stale refocus won, the highlight moved to the clicked pane and the keystrokes kept going to the old one.ActiveSessiontoSessions.LastOrDefault(). ThewasActiverestore then setActiveSessionback to the revived session but never focused it.Fix
OnWindowActivatedskips the refocus while any mouse button is down (GetAsyncKeyState, all three buttons, because swapped mouse buttons are physical). A click-to-activate is the user choosing the target. Alt+Tab and taskbar activation still refocus the active terminal as before.PaneActivated(a click in a pane) now promotes and focuses that pane. This makes the result independent of the order in which the activation and the page message arrive. It is throttled to 300 ms on the page side.wasActivepath callsFocusTerminal()on the revived session.CLAUDE.md"What makes a session active" records the rule: settingActiveSessionmoves the highlight, not the keyboard.Testing
dotnet buildpasses and the unit tests pass (1183/1183).🤖 Generated with Claude Code