A simple, high performance text editor.
TextField.Draw re-pushed key.SnippetCmd and key.SelectionCmd every frame while focused. Re-pushing an unchanged snippet resets the IME's composition and caret, so commits arriving faster than a frame interleaved with those resets and desynced the cursor (garbled/duplicated text). Mirror widget.Editor's updateSnippet/selection gating: track the last-pushed snippet and caret in the main-owned Renderer (keyed by field ID, reset on focus (re)gain), and only emit the ops when they actually change. A fresh push is forced whenever the field (re)gains focus so the IME always starts from a known state. Also drop a leftover per-frame 'Focused:' debug print. On-device: rapid back-to-back commits (0.08-0.1s cadence, faster than a frame) now land cleanly - type HELLO, append+backspace, and a browser->editor navigation round-trip all produce exact content. go test -race ./... green. |
||
|---|---|---|
| .qwen | ||
| cmd/pad | ||
| doc | ||
| internal | ||
| .DS_Store | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||