From c2918fa7c1b69efbc1a147a3e8e0f5eed6fc9877 Mon Sep 17 00:00:00 2001 From: Greg Pomerantz Date: Sun, 16 Aug 2026 13:01:02 -0400 Subject: [PATCH] Doc: mark IME rapid-commit desync fixed (snippet/selection dedup) --- doc/development_plan.md | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/doc/development_plan.md b/doc/development_plan.md index 00af330..374d089 100644 --- a/doc/development_plan.md +++ b/doc/development_plan.md @@ -4,9 +4,9 @@ Status: v3, 2026-08-16 (Phases 0–3 complete). Written against the **live** rep `/home/gmp/pad`. v1 (the widget-rebuild plan) is superseded — see §12 for why. Phases 0–3 done: single-owner no-lock architecture, Android IME wiring, on-device IME validation (passing), viewport-on-open fix, chunked-buffer drift fix, the -whole-file shaper memory-leak fix, and a measured 50 MB size limit. Remaining: -rapid-synthetic-IME-commit desync hardening and real-device swipe/autocorrect -sign-off. +whole-file shaper memory-leak fix, a measured 50 MB size limit, and the IME +rapid-commit desync fix (snippet/selection dedup). Remaining: real-device +swipe/autocorrect sign-off (the emulator's AOSP/Gboard keyboard is a proxy). ## 1. Decision summary (updated) @@ -172,12 +172,15 @@ API 35 `google_apis/x86_64` system image installed to `~/android-sdk`; AVD editor tap. Needs: ignore the opening tap in the editor (or clamp `SetCursorFromPoint`/scroll so a short file that fits the viewport never scrolls). -3. **Rapid synthetic IME commits desync (edge case):** `adb shell input text - "…"` fires per-char commits faster than a frame; the per-frame `SnippetCmd` - re-push resets the IME's cursor, so fast commits interleave/corrupt - (observed `" IME123"` → `E123IM…`). Real typing (human cadence) stays in sync - (validated above). Robustness note for Phase 3: only re-push the snippet when - it actually changes, or suppress re-push mid-composition. +3. **Rapid synthetic IME commits desync (edge case) — FIXED:** `adb shell input + text "…"` fires per-char commits faster than a frame; the per-frame + `SnippetCmd`/`SelectionCmd` re-push reset the IME's cursor, so fast commits + interleaved/corrupted (observed `" IME123"` → `E123IM…`). Fixed by deduping the + IME ops in `TextField.Draw` — push the snippet/selection only when they change + (and force a fresh push on focus (re)gain), mirroring `widget.Editor`'s + `updateSnippet`/selection gating. State lives in the main-owned `Renderer` + (commit `46383c1`). On-device, rapid commits (0.08–0.1 s cadence) now land + cleanly. Observation loop that worked (no state-dump flag needed in the end): logcat (`imeDebugLog` + `HandleKeyDown` + `VisibleByteRange`), autosaved-file diff via @@ -206,9 +209,13 @@ Observation loop that worked (no state-dump flag needed in the end): logcat (10 MB → ~150 MB PSS; 50 MB extrapolates to a few hundred MB, fine on a phone). Larger files get a "too large to edit" state; the browser still lists them. ✓ -5. **Remaining (not blocking usability):** rapid *synthetic* IME commit desync - (only re-push the snippet when it changes) and real-device swipe/autocorrect - sign-off. +5. **IME rapid-commit desync fix**: `TextField.Draw` now dedups the IME + `SnippetCmd`/`SelectionCmd` (push only on change, fresh push on focus + (re)gain; state in the main-owned `Renderer`), mirroring `widget.Editor`. + Rapid commits (0.08–0.1 s cadence) land cleanly on-device (commit + `46383c1`). ✓ +6. **Remaining (not blocking usability):** real-device swipe/autocorrect + sign-off (the emulator's AOSP/Gboard keyboard is a proxy for real IMEs). ### Phase 4 — the v1 simplifications, now that it's usable (optional, later) Only after the app is usable: replace globals (`TheState`, `ui.OpenFile`) with