Repository navigation
mac: SyntaxPainter.flush() stops polling during an IME composition (#780) - #825
Conversation
) Found during independent review of the #681 fix. While the text view had marked text (an IME composition in progress), flush() unconditionally rescheduled itself on the main queue every runloop turn, for as long as the composition lasted -- a main-thread busy-spin. The reschedule was unnecessary: every way a composition ends (insertText commit, setMarkedText("") cancel, bare unmarkText) performs a character storage edit that storageEdited already observes, which schedules a fresh flush() on its own. Dropped the self-reschedule entirely; flush() now just keeps the dirty range and returns while marked text exists, incrementing a new deferredFlushes evidence counter instead. Investigated one suspected gap before ruling it out: whether cancel's setMarkedText("") might not produce an edit storageEdited observes. It does (mask 2, characters, nonzero delta) -- the observer needed no change, confirmed by reverting a speculative widening and rerunning the cancel test, which still passes. Tests: new SyntaxPainterIMETests (4 tests, real NSTextView + real SyntaxPainter, real NSTextInputClient calls) cover no-reschedule-while- composing, commit, cancel and bare-unmark, each asserting the lexer stays in sync and a repaint happens. SyntaxHighlighterTests (17/17) and a broader editor-level regression sweep (33/34, one pre-existing helper-dependent skip) both independently re-run clean by the supervisor. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane ime-flush-spin, slice 1) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet) Co-authored-by: d-q222 <[email protected]>
|
Transparency note (supervisor): this Muse lane's check-in disclosed that it moved the worktree's |
|
Commander (daniel-parent): independent Opus review of PR #825 —
|
…he integration batch + package definitions The pin reads main again after the second integration pass (#827 cherry-picks, #863, #950, #737/#739/#758/#732/#740/#825, visual-oracle tooling) and the `metadata.packages` work (`crate::package_definitions`, tex-expansion's `package_defs.rs`). `git archive` of this tree's `crates/compiler` and `crates/tex-expansion`, PINs at the merge commit, VENDORING.md rows updated, `scripts/check-vendor-pins.sh` both "up to date". render-pipeline 819/0 in both profiles against the new pins; compiler 1368/0, tex-expansion 150/0 release; Mac inventory sync current; swift build clean. Implementation-Agent: Claude Code (mac-claude-a) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
What
While the text view had marked text (an IME composition in progress),
SyntaxPainter.flush()unconditionally rescheduled itself on the main queue every runloop turn, for as long as the composition lasted — a main-thread busy-spin.The reschedule was unnecessary: every way a composition ends (
insertTextcommit,setMarkedText("")cancel, bareunmarkText) performs a character storage edit thatstorageEditedalready observes, which schedules a freshflush()on its own. Dropped the self-reschedule entirely;flush()now just keeps the dirty range and returns while marked text exists, incrementing a newdeferredFlushesevidence counter instead.One suspected gap was investigated and ruled out: whether cancel's
setMarkedText("")might not produce an editstorageEditedobserves. It does — confirmed by reverting a speculative observer widening and rerunning the cancel test, which still passes with the lexer fully in sync.Tests
New
SyntaxPainterIMETests(4 tests, realNSTextView+ realSyntaxPainter, realNSTextInputClientcalls): no-reschedule-while-composing, commit, cancel, bare-unmark — each asserting the lexer stays in sync and a repaint happens.SyntaxHighlighterTests(17/17) and a broader editor-level regression sweep (33/34, one pre-existing helper-dependent skip) both independently re-run clean by the supervisor.Closes #780.
Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane ime-flush-spin, slice 1)
Commit-Executor: daniel-muse-lead (Claude Sonnet)
Reviewed-by: daniel-muse-lead (Claude Sonnet)
🤖 Generated with Claude Code