Pad/internal/test/e2e
Greg Pomerantz 0f1b6e6290 Hold the restored scroll on its line while wrap counts settle (spec §2.4)
On device (Pixel 9 Pro) the relaunch landed further UP than the saved
position: while the restore scroll is still armed (scale + size + content
can take ~600 ms), the top-of-file window is what gets rendered, and its
shaping feedback — real wrap counts for lines ABOVE the restored line —
lands before or just after the offset is applied. The counts are correct
data, but they change V(line), so the line-derived offset (synthesized
for the all-estimate index) maps to a shallower line and the viewport
drifts up; the save then persists the drifted line and every subsequent
relaunch lands there.

Fix: the restore pins the logical line. Until the restored window's own
shaping arrives (or a 2 s timeout, or the user scrolls / a search jumps),
every accepted wrap correction re-derives the offset as
VisualsBefore(line)*lh + sub under the corrected index. The pin refresh
does not clamp to MaxScroll: the correction just grew the index, so the
pre-layout clamp value is stale and would under-clamp the re-derived
offset (the layout of the emitted frame clamps to the fresh value).

Also: the apply-time offset is mapped through VisualsBefore under the
current index (identical to line*lh while the index is all estimates),
so pre-apply corrections are absorbed instead of gated away.

Verified on device: saved line 420 -> restored 420 (was 333); saved 573
(near EOF, clamp territory) -> restored 573. New e2e regression
TestRestore_LinePinHoldsAcrossLateWrapFeedback replays the late
top-window feedback and fails pre-fix (window drifts 200 -> 66).
2026-08-20 21:03:56 -04:00
..
assertions.go Add e2e test harness for testing editor logic without Gio display 2026-05-31 08:56:30 -04:00
browser_files_test.go Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
capture.go Add e2e test harness for testing editor logic without Gio display 2026-05-31 08:56:30 -04:00
cursor_interaction_test.go Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
edit_lifecycle_test.go Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
find_test.go Find bar X clears the query instead of closing the bar 2026-08-20 13:00:21 -04:00
harness_test.go Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
harness.go Add text selection, real-file e2e tests, and Android arrow-key support 2026-08-17 00:32:53 -04:00
helpers.go Add e2e test harness for testing editor logic without Gio display 2026-05-31 08:56:30 -04:00
idle_frames_test.go Add pre-release frame-regression profiling 2026-08-20 14:18:08 -04:00
real_file_chunk_boundary_test.go Add text selection, real-file e2e tests, and Android arrow-key support 2026-08-17 00:32:53 -04:00
real_file_edit_test.go Add text selection, real-file e2e tests, and Android arrow-key support 2026-08-17 00:32:53 -04:00
real_file_fuzz_test.go Fix write-concurrency race: per-file write protocol + unique temps 2026-08-17 16:29:47 -04:00
real_file_scroll_selection_test.go Fix scroll-anchored selection (shadowing) + IME insets keyboard handling 2026-08-17 21:52:53 -04:00
restore_test.go Hold the restored scroll on its line while wrap counts settle (spec §2.4) 2026-08-20 21:03:56 -04:00
scroll_cursor_test.go Make editor top/bottom bars full-width; keep margin on the text area 2026-08-19 22:36:05 -04:00
search_test.go Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
sort_mode_test.go Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
touch_selection_e2e_test.go Handle drags: 1:1 finger tracking with cross-flip; fix caret/taps on empty lines 2026-08-19 22:34:12 -04:00
type_at_start_test.go Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
write_serialization_test.go Fix write-concurrency race: per-file write protocol + unique temps 2026-08-17 16:29:47 -04:00