The boundary trace (PADIME at EditorStateChanged) showed why a
desynchronized IME never heals itself: gioui's EditorReplace advances
its stored selection state when the commit arrives, so the
post-commit selection push is always deduplicated away and
updateSelection is never sent after a commit. A desynced IME is
therefore healed only by a snippet restart — and the resync was
armed only after THREE consecutive anomalies, while the phone
incident's first anomaly (a 5-rune autocorrect 19,000 runes from
the caret, width > 2) sailed through the old <=2-rune guard and
clobbered distant text before any resync could fire.
Now:
- the guard also snaps commits that are far from the caret AND
outside the live selection (a legitimate commit is always local:
at the caret, inside the selection, or a nearby correction);
a distant commit lands at the caret instead of clobbering text;
- the resync is armed on the FIRST anomalous commit (snapped or
distant), not after a streak; the streak counter is gone;
- imeSelectionRuneRange() lets the guard allow selection
replacements anywhere.
TestRealFile_IMEForceResync rewritten for the new semantics and
extended with the distant-replacement case (must land at the
caret and arm the resync).
Brings gioui.org/shader along to v1.0.9. This is the dependency set the
current build and on-device tests run against (go build, full test suite, and
the phone APK all pass with it).
- Element interface with Region() and Visible() methods
- Label and ListView element types with constructors
- Renderer that clips and draws elements in slice order
- Main app loop with Gioui window and frame events
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>