a83cc1a72fadbd4444d69a37f166b22bd0e62467
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).
Description
A simple, high performance text editor.
50 MiB
Languages
Go
92.7%
Shell
4.7%
Java
1.1%
C
0.8%
Python
0.7%