From 0cc7413bbf1d546f29976b9639896a209e2e7f27 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 18 Nov 2026 11:31:49 -0300 Subject: pdf: a view laid out as the active one is (a window client the size of its session's window) takes the active view's top as it is, fraction and all, where it took it from the place rounded to a pixel: the client's own view, whose wheel moved it, showed its pages at the top's floor and the session's window at the place's rounding, a pixel lower or higher whenever a glide or a touchpad left the top at half a pixel or more (68,362 pixels of the lower page in 4 of 10 and 4 of 8 runs of a window client of a window session with a picture beside the PDF, 0 of 10 without the picture); 20 runs after: 0 differ; a session with one view lays out as before; a test of a window client and its session's window of one size, 0.6 of a notch scrolled in the client: the same rows shown (fails before: src.y 25 against 24); tui core-test 820/959 (139 skipped), shell-test 994/997, behaviour-test 274/274, --replay 20 seeds 0 failures, pane-test 181/182, replicas pass, addon-test 1/1, process-test 2 of 144 failed (lspcomplete and lspcompletemoved, the base's), test/daemon.py, --far, --games and --window-clients pass; gui unit-test 1589/1593 (its perf check's BaselineBuildMismatch, the base's), the frame corpus 77/77 against mbase2 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- addons/pdf/pdf.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'addons') diff --git a/addons/pdf/pdf.zig b/addons/pdf/pdf.zig index c9a49b7c..1e0fb311 100644 --- a/addons/pdf/pdf.zig +++ b/addons/pdf/pdf.zig @@ -1209,7 +1209,12 @@ fn layout(st: *Pdf, l: *Layout, k: usize) void { } if (l.rev != st.rev) { // a pixel's: P:F rounds const sp = stripOf(st, ownOf(st), k); - l.top = @round(f64Of(sp.y[st.page]) + std.math.clamp(st.frac, 0, 1) * f64Of(sp.ph[st.page])); + // Laid as the active view is (a window of its size in another + // process): the active's top as it is, a fraction and all, so the + // two show the same pixels (from P:F, rounded, one showed its page + // a pixel off the other's). + const same = if (pixels(st, st.active)) |a| a != l and a.rev == st.rev and a.vw == vw and a.vh == vh and a.fit == l.fit else false; + l.top = if (same) st.views[st.active - 1].top else @round(f64Of(sp.y[st.page]) + std.math.clamp(st.frac, 0, 1) * f64Of(sp.ph[st.page])); l.rev = st.rev; } l.top = std.math.clamp(l.top, 0, f64Of(l.height -| l.vh)); -- cgit v1.3