Skip to content

Land a tall paragraph's gist where its words were read, and test that a find keeps its place - #5408

Merged
max-sixty merged 5 commits into
mainfrom
agent-a8b82c62e4140f5f2
Nov 5, 2026
Merged

max-sixty merged 5 commits into
mainfrom
agent-a8b82c62e4140f5f2

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Three follow-ups to the one hold from #5396, from its reviews.

  • Skim folding a paragraph that began above the window landed its gist at the paragraph's top, 978px above the window for a 2,700px paragraph, and Read then moved the page 3,244px, on main before Keep the user's place with one hold where scroll anchoring can't, in place of placeKeeper and the seat's hold #5396 too. The dial now lands the gist where the words read stood when their paragraph began above the window, and Read moves it 0.2px. A paragraph that begins inside the window still hands its top to its gist, so the dial's turns stay at −0.4px. The hold-still matrix adds dial-begun × dial-turn, a paragraph twelve times the cause's length read in its middle with its top 400px above the window; with the dial's change reverted it fails in both engines, the gist landing 1,842px up. The gist's box lands where the words' letters stood, which puts its own letters half a leading lower (2.1–2.5px), so the case reads the gist by its box.
  • The contract says which readers the reading line is held for. browser/AGENTS.md promised it for every reader, but the hold keeps it only for a reader whose focus is scrolled away; a reader who focused nothing is left to anchoring, which holds the first block in view. Holding the line for that reader too was tried and rejected, and the hold's header records why: it kept a diff's line still as five rows joined above it (100px on main), but moved words above the line that the change left alone from 45px to −55px, carried a selection drag through the new rows, let a pointer resting over a second column move the first column's words 100px, and let a press inside an embedded frame move what it opened by 140px. The hold-still matrix keeps that case as a strict expected failure, diff-reading × deletions, and adds reading-unfocused × edit-paragraph, which passes.
  • A find on words already on screen keeps its place through a later width change, and now has a test: test_words_found_on_screen_become_the_readers_place, which asserts the found words stay in view, as does the closed-fold test beside it, since how far they move within the window depends on how the filler above them rewraps under the host's fonts. It fails when scrolling.js stops counting a single scroll that no layout change explains as the reader's choice. That is the rule a scroll tracker labelling every scroll when it starts would have dropped, since the browser's find sends the page no input, so the cutover doesn't build one.

Runtime +10 lines, all header prose in user-place.js; lf-dial.js +2; tests +110; docs +1.

This was written by Claude Code on behalf of max-sixty

…ll paragraph's gist where its words were

Against origin/main 07f31d7, in Chromium and Firefox:

- A reader who focused nothing reads in the page's own column, and the reading line
  is held there: five diff rows joining above the line read, with the pointer aside
  (review6_reading_unfocused), 100 -> 0. `holdUserPlace` asked `readingAt` only of a
  focused control, so with focus on the body it held nothing.
- The reading line's column is the reader's, as the reading place chooses it: their
  pointer where it last named their place, else the focus they stand on, else the
  middle (`readerColumn`, moved from reading-place.js to user-place.js, which both
  read). The reader's column holds words only where they stand under it, since Firefox
  answers a point beside the words with the nearest letter on its line; the middle
  keeps the nearest letter, so a gap between two paragraphs still names one of them.
  A letter that names no place, as a diff's sticky line number does in Firefox, gives
  way to the element drawn there, and words straight in a shadow root name their host
  (scroll-containers.js, `holderOf`), so the bare-text shadow case is now held rather
  than left to anchoring.
- Skim folding a paragraph that began above the window (review6_range_dial, a 2,700px
  paragraph, words read at the reading line): the gist landed at the paragraph's top,
  -978px, and Read moved the page 3,244px; it now lands where the words read stood,
  195px, and Read moves it -0.2px. A paragraph that began in the window still hands its
  top to its gist, so the four dial-turn cells stay at -0.4.

The 126px test with the reply box never focused cannot exercise this: a thread the
user isn't in holds the edit behind its notice, so the paragraph never redraws.

Matrix: reading-unfocused x edit-paragraph (nothing focused, an agent's edit of the
message above the line read; held behind the thread's notice, 0 on main and here) and
diff-reading x deletions (nothing focused, five rows join above the diff line read;
100px on main, 0 here). Revisions still take no hold: reading-page x revision-on-screen
and x revision-removes stay expected failures. 104 cases: 90 passed, 14 xfailed.
… width change

Find-in-page that lands on words the page already draws scrolls in one
move, with no input the page hears and no layout change behind it.
`scrolling.js` counts that move as the reader's choice through the
classifier clause for a single move no layout change explains, so
continuity records the found place and a later width change keeps the
found words in view. No test covered it: the existing find test opens a
closed fold, which the `beforematch` clause answers instead.

`test_words_found_on_screen_become_the_readers_place` runs in Chromium,
whose `window.find` scrolls to a drawn match as Firefox's does. It
passes on main. With the classifier's "several scroll events" and
"single move with no layout change" clauses removed, it fails: the
found heading stood at 349px after the find and at 2474px after the
width change, because the page returned to its top. Removing only the
"several scroll events" clause leaves it passing, so it guards the
single-move clause.

A scroll tracker that attributes each sequence when it starts, and
counts every sequence no input or Leaf write claims as layout's, would
fail this test.
…d6f4

9c1d6f4 held the reading line for a reader with nothing focused. Review measured
three regressions against origin/main 07f31d7 from it, in Chromium and Firefox:

- Words above the reading line that the change left alone stood at -55px where
  anchoring left them at 45px, as five diff rows joined between them and the line, and
  a drag selecting them ran on through the rows that joined.
- A pointer resting over a second column made that column's diff line the place and
  moved the first column's words from 234px to 134px.
- A press inside an embedded frame, which the page hears nothing of, left the keep to
  move what it opened by 140px.

The reading line is a guess at where a reader reads, and with nothing focused
anchoring's guess, the first block in view, serves as well and needs no rule. This
undoes the hold for that reader and what existed only for it: `readerColumn` returns to
reading-place.js, `readingAt` takes the middle of its column again with no pointer or
stuck-letter rule, and `holderOf` no longer names a shadow root's host for words
straight in it. With them gone, all three journeys measure as on main, and a diff line
read with nothing focused moves 100px as five rows join above it, as on main.

browser/AGENTS.md and the hold's header now say the reading line is held for a reader
whose focus is scrolled away, and the header records holding it for every reader as
rejected, with those numbers.

Kept from 9c1d6f4: Skim folding a paragraph that began above the window lands its
gist where the words read stood (review6_range_dial: 195px, where main put it at
-978px), and the dial-turn cells stay at -0.4. And the find test (7c149d3).

Matrix: diff-reading x deletions is a strict expected failure in both engines (100px,
as on main); reading-unfocused x edit-paragraph stays as it was. 104 cases: 88 passed,
16 xfailed.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_words_found_on_screen_become_the_readers_place fails here every run on Linux Chromium: assert 539.5 == 349.25 ± 40, three runs out of three on the PR's merge ref. The page keeps its place through the width change. But the place it keeps is the filler paragraph at the reading line, about 150px above the heading, not the found heading. At 600px wide those filler paragraphs wrap to two lines, so the heading lands 190px lower. Whether the ±40 holds depends on whether the filler rewraps under the host's fonts, not on the rule the test guards. The PR's test job will likely go red the same way.

The docstring's claim, that the found words stay in view, is enough to tell the two readings apart. With the inline suggestion applied, the test passes on this head. With scrolling.js's single-move clause disabled (chosenHere without the ended.get(box) !== box.scrollTop && … branch), it fails: the page returns to scrollY 0 and the heading stands at 4105px. So it still catches what the description says it catches.

Separately, nothing pins the lf-dial.js change, where a paragraph that began above the window lands its gist where the words read stood. The 978px and 0.2px figures in the description come from a measurement, and the existing dial places use paragraphs that begin inside the window. A Place on the dial scene whose paragraph starts above the window, crossed with dial-turn, would keep that from regressing silently.

…above the window

The find tests asserted the found heading kept its offset within 40px through a width change. What the page keeps is the reading line's paragraph, so the heading's offset from it grows with how far the filler rewraps: 190px under Linux Chromium's fonts, which failed CI. Both tests now assert what their docstrings claim, that the found words stay in view; read as layout's, the find's scroll returns the page to its top, which still fails them (the reviewer checked with scrolling.js's single-move clause disabled).

The matrix gains `dial-begun × dial-turn`: Skim folding a paragraph twelve times the cause's length, read in its middle with its top 400px above the window. With lf-dial.js's begun clause reverted the gist lands 1,842px up in both engines; with it, the gist's box lands where the words read stood. Its letters sit half a leading lower, 2.1-2.5px, so the case reads the gist by its box.
@max-sixty
max-sixty merged commit 09e5249 into main Nov 5, 2026
5 checks passed
@max-sixty
max-sixty deleted the agent-a8b82c62e4140f5f2 branch November 5, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants