A simple, high performance text editor.
maybeApplyRestoreScroll applied the offset as soon as the content had landed, then clamped it to MaxScroll. For a string buffer (small file) MaxScroll derives from the shaper's last baseline, which is still 0 at that point - nothing has shaped yet - so every restored offset was clamped to 0 and the scroll position was silently lost on relaunch (the line-pin that re-derives the offset had already been armed from the zeroed value). Wait for the first shaped frame (its feedback triggers the emitFrame that re-runs the apply; a chunked buffer's MaxScroll is measured from the line index and needs no such wait). A deadline bounds the wait so content that never produces a baseline (empty, newlines-only) cannot leave the restore armed forever - it lands best-effort. Verified on the emulator: 120-line file, scroll to line 75, relaunch - lands at line 75 (log: RESTORE scroll off=1272.7 line=75 maxScroll=1272.7; before the fix: off=0.0 maxScroll=0.0). |
||
|---|---|---|
| .qwen | ||
| cmd/pad | ||
| doc | ||
| internal | ||
| scripts | ||
| tools/touchinject | ||
| .DS_Store | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||