Repository navigation
refactor(track): split FocusTracker::run into FocusRun steps (#477) - #482
Merged
Merged
Conversation
…un (#477) Move-only. run()'s locals become FocusRun members (same declarations, same order, same comments), its five lambdas become member functions with unchanged bodies, and its body is split into setUp (COM, UIA timeouts, focus lookup, focus handler, WinEvent hooks, first retune), messageLoop and tearDown. run() keeps the queue/thread-id prologue and the final tid_ = 0. The tracker members the steps use are aliased so the moved code is byte-identical. Everything still runs on the tracker thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…avaCaret (#477) Move-only: the java decision and the event-driven bridge read move verbatim; resolve calls it at the same point and keeps the result in the same const. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
…owCaret (#477) Move-only: step 2 of resolve (find the caret, slow-resolve log, trim/hold, baseline or publish) moves verbatim; resolve calls it at the same point, before releasing the focused element. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH
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.
Closes #477
Pure refactor of
FocusTracker::run(src/focus_track.cpp, 411 lines) from the 2026-10-13 repo review ("Second-tier oversized functions"). Move-only: same side-effect order, same early returns, same logging and timing (slow resolve,rs0/rs1/fc0/fc1), same thread (everything still runs on the tracker thread).Shape
run()'s locals become members of a private helper structFocusRun(same declarations, same order, same comments;h1..h3now start null and are assigned insetUp). Its five lambdas become member functions with unchanged bodies. The tracker members the moved code uses (tid_,active_,wantCaret_,wantFocus_,log_,publish) are aliased inFocusRun, so the moved lines are byte-identical.FocusTrackergetsfriend struct FocusRun;.Functions (line ranges in the new
src/focus_track.cpp)FocusRun(struct: aliases, state, steps)FocusRun::retuneretunelambdaFocusRun::fixLineWideFocusRun::focusClassFocusRun::editContextCaretFocusRun::findCaretFocusRun::readJavaCaretresolveFocusRun::resolveFocusRun::followCaretresolve(find caret, trim/hold, baseline or publish)FocusRun::setUpFocusLookup, focus handler, WinEvent hooks, firstretuneFocusRun::messageLoopGetMessageWloopFocusRun::tearDownCoUninitializeFocusTracker::runsetUp/messageLoop/tearDown,tid_ = 0Construction and destruction order are unchanged in effect:
FocusRunis built after the stop check and beforeCoInitializeEx(its members have no side-effecting constructors;JavaBridgehas none), and it is destroyed at the end ofrun()aftertid_ = 0, where the locals used to be.How move-only was checked
Per commit, the diff was taken with
--color-moved=plain(moved lines coloured separately) and only the non-moved+/-lines listed. What remained was only: the struct header and aliases,auto x = [&](...) -> R {toR x(...) {(and};to}),HWINEVENTHOOK hN = SetWinEventHook(...)tohN = SetWinEventHook(...), the new function heads and braces,return java;, and the call sites (const bool java = readJavaCaret(fg, fromPoll);,followCaret(el, b, fg, java, fromPoll, rs0, rs1);,r.setUp(); r.messageLoop(m); r.tearDown();). Review with--color-moved=zebra --color-moved-ws=allow-indentation-change.Commits: one for the struct move, one per
resolveextraction, one for docs (docs/architecture/07-cursor.mdnow names the steps).Gates
build.bat check: pass (only the existingfopenC4996 warnings)build.bat test: exit 0, 643/643 test casesbuild.bat: linksWind.exeandWindTray.exesrc/config_uiandui/untouched, so no config build or Playwright runNot deployed or run (no runtime change intended).
🤖 Generated with Claude Code
https://claude.ai/code/session_01TdjopXZfsUiesYxYLYHEdH