A simple, high performance text editor.
Persist a tiny JSON snapshot (SessionState) written by the cmd layer ($HOME/.pad/session.json off-Android, /storage/emulated/0/Pad/ on Android) and call the logic-owned snapshot rate-limited (<=1/s, on change) from emitFrame plus unconditionally at Shutdown. On launch the cmd layer hands the snapshot to Logic.BeginRestore before Run; the file re-opens through the normal openFile path and lands straight on the editor page. - Cursor/selection land with the content, clamped to a shrunk file (path-guarded so a late result for a replaced file cannot apply the snapshot to the wrong buffer); a missing file falls back to the browser. - Scroll is applied only after the first ScaleEvent has been laid out: the size ConfigEvent precedes it and the one-way MaxScroll clamp in a wrong-unit layout would corrupt the offset (found by e2e). - Find: query + open/closed + current match are persisted; results are regenerated by re-scanning and the saved current match is re-selected by byte offset (Find.Restoring/RestoreMatch) without re-scrolling the restored viewport. A closed-bar query re-scans on the next bar open instead (an eager scan would be dropped and leave Scanning stuck). - The main-owned find_bar widget is seeded with the restored query so its first frame matches the logic-side query. Docs: spec.md gains §2.4 and drops the §7 row; invariant 5 updated; architecture.md gains §6.7. Tests: 7 e2e tests covering cursor/scroll/ selection restore, clamping, missing-file fallback, find-bar restore (open/closed), and the saver/shutdown persist paths. |
||
|---|---|---|
| .qwen | ||
| cmd/pad | ||
| doc | ||
| internal | ||
| scripts | ||
| .DS_Store | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||