Repository navigation
Run a diff row's fill to the end of its line - #784
Conversation
Pierre sizes the code column `1fr`, which is the width of the box that scrolls, so a changed row painted its green or red only as far as the reader could already see. On the walkthrough's widest file the fill ran out 2,563px short of the line's end: scrolling right left every addition and deletion sitting on the file's plain paper with nothing to say which it was. The track takes its floor from the longest line and keeps `1fr` over it, so a file whose lines all fit still fills its box rather than ending at its longest line. A thread's prose shares that column and its max-content is the whole comment on one line, which would size the code by the longest remark instead — 1579px where the lines wanted 745px — so the outlet is contained in the inline axis and stays out of the measure. The wrap switch and the print sheet both drop the floor, since a wrapped line still measures its unwrapped self. Two probes read a row against its own box, which this resizes; both now read it against the file's scrolling box, which is what "can the reader see the end of this line" means either way. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The tint on a highlighted line stops at the scrollport, which is the same question the diff just answered from the track. Name the fix beside the rule, with the two parts of lf-code that make it a separate change: its notes share the column, and they position sticky. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The floor makes the diff's code column content-sized for the first time, so every element standing in that column now decides how wide a file's rows are. contain: inline-size on the thread outlet is the only thing keeping reader prose out of that measure, and nothing in the suite holds it there: I removed that one declaration and ran tests/test_render_widgets.py with tests/test_render_visual_review_journey.py — 177 passed, unchanged.
The regression it prevents is reachable from the fixture the new case already uses. On LONG_LINE_DIFF_PAGE, app/routes.py is the short file — box 718px, gutter 47px, rows 671px, code[data-code].scrollWidth 718px, so it fits and narrow is zero. Leave one ordinary remark on line 201 and, with the containment removed, the rows go to 796px and scrollWidth to 843px: a file that fit its box starts scrolling sideways, and every row overhangs what the reader can see. With the declaration in place the same sequence leaves 671/718 untouched.
The new case reads a page with no threads, so a green result there is consistent with the outlet being back in the measure. _bound_diff and _SELECT_IN_ROW already do the work — reading DIFF_ROW_FILL once more after a comment lands would pin that half the way short and narrow pin the other two.
Separately, _bound_diff's docstring still opens "The review the three diff tests below read"; this PR makes it four.
The floor measures everything standing in that column, and nothing held the outlet's containment there: removed, one ordinary remark on the file whose rows fit their box took them from 671px to 796px and set a file the reader could see whole scrolling sideways, 843px of content in 718px of room. What binds is not the remark's own length but the thread's own 760px cap, plus the outlet's padding, so any remark long enough to reach it does the same. The reading goes in before the wrap step, so the wrapped rows are measured with a thread among them too. Found by leaf-agent in review, which named the file and the line. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Both taken, in I reproduced your deletion control and got your numbers exactly — 671px of rows to 796px, 843px of content in 718px of room,
|
|
Both closed. I ran the control on Your refinement is the more useful fact, and it changes what the case has to hold: since the 796px comes from the thread's own cap rather than the remark, the case is only sound while its remark clears that cap — a shorter one passes with the declaration gone, which is the failure mode your first draft found. The comment beside the declaration now carries the figure that says so, so the next person to shorten that string has the reason in front of them. |
leaf-agent
left a comment
There was a problem hiding this comment.
DIFF_CLIPPING still reads each row against the row's own box, and this PR is what made that box the width of the file's longest line rather than the line's own. Every row in a file that scrolls now reports the same overhang, so the probe no longer names the line that overflows: on LONG_LINE_DIFF_PAGE it reads {'rows': 24, 'cut': 18, 'worst': 1143, 'widest': ' # third tail'} — all 18 of app/handlers.py's rows counted cut where one line overflows, with widest naming a trailing-context line the reader can see whole. That is also the reading test_a_wrapped_diff_shows_every_line_whole_and_paper_wraps_whatever_the_switch_says leans on: cut["cut"] > 0 and cut["worst"] > 300 is the population that makes the wrapped result mean something, and it now establishes only that some file scrolls.
Measuring the row's text rather than its box restores it — a Range over the row's contents, which is the measurement _SELECT_IN_ROW moved to for its own cut in this same PR. With the suggestion below applied the same fixture reads {'rows': 24, 'cut': 1, 'worst': 1120, 'widest': ' return "The comparison base is the merge-base'} unwrapped, cut: 0 wrapped and cut: 0 under print media, and pytest tests/test_render_widgets.py -k diff -n0 stays at 5 passed. The probe's comment wants the matching edit — what it measures is the row's text against the room, not the row against its box. Say the word and I'll push both.
Separately, the description still carries the 1579px figure and the mechanism bcf9beea retracted: "its max-content is the whole comment on one line, which sized the code to 1579px where the lines wanted 745px". The merge takes PR_BODY as main's commit message for this change, so that is what history keeps rather than the cap-and-padding reading the CSS comment now carries.
Every row is sized to the longest line in its file so its fill reaches the end of it, which leaves `row.scrollWidth` the same number for all of them and the reading taken off it saying nothing about any one line: 18 of 24 rows counted cut where one line overflows, and `widest` naming a trailing context line the reader can see whole. A Range over the row's contents measures the line instead, which is what `_SELECT_IN_ROW` moved to in this same branch and for the same reason. The reading names the overflowing line again, and an assertion now holds it to naming it — the box reading passed the whole suite while it was wrong, which is what let it through. Found by leaf-agent in review, with the fixture's numbers both ways. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Both taken, in One addition to your patch. The box reading passed the whole suite while it was wrong, so the count alone could not tell the two apart and nothing stopped it degenerating again; the unwrapped reading now also asserts that The description is rewritten — the 1579px figure came from a scratch probe that injected raw text with no thread wrapper and so no cap, which is exactly why it disagreed with the page. I confirmed your premise rather than assuming it: Thanks for both findings — each named the file, the line and the numbers, which is what made them quick to confirm. I pushed them myself rather than taking you up on the offer, since the branch is mine.
|
|
Ran the control rather than reading it. On That assertion is the whole guard on the probe, since |
Pierre sizes the diff's code column
1fr, which is the width of the box that scrolls, so a changed row painted its green or red only as far as the reader could already see. On the walkthrough's widest file the line runs 3,234px inside a 718px box and the fill stopped at 671px: scrolling right left every addition and deletion sitting on the file's plain paper with nothing to say which it was.The track now takes its floor from the longest line and keeps
1frover it, so a file whose lines all fit still fills its box rather than ending at its longest line. That floor measures everything standing in the column, which is where the other two changes come from. A thread outlet stands there with the lines, and what it contributes is not its remark's own length but the thread's ownmax-width: 760pxcap plus the outlet's padding — a 796px contribution from any remark long enough to reach that cap, against the 671px of rows in the file it was measured on, so one ordinary remark set a file that fit its box scrolling sideways with 843px of content in 718px of room. Inline-size containment keeps the outlet out of the measure while it still stretches and wraps. And the wrap switch and the print sheet both forcepre-wrapwhile a wrapped line still measures its unwrapped self, so both drop the floor.Three probes had to move with it, because the rows are now all one width — each sized to the longest line in its file — and a reading taken off a row's own box no longer says anything about that row's line.
DIFF_CLIPPINGand_SELECT_IN_ROWboth measure the row's text now, by a Range over its contents, against the room the scrolling box gives it; without that,DIFF_CLIPPINGreported the file's overhang for all 18 of one file's rows where one line overflows, and named a trailing-context line the reader could see whole. Each has an assertion holding it to naming the overflowing line, so it cannot quietly degenerate again. The newDIFF_ROW_FILLcase asserts the fill reaches both the line's end and the box's edge, and reads again after a comment lands; every one of those was verified paired, green with the change and red without it.Measured on the 47-file patch: 3,769 rows relayout in 147-150ms against the baseline's 154-156ms, across two paired rounds, so the intrinsic sizing costs nothing here.
One commit only adds a TODO:
lf-codehas a milder version of the same defect, where a short highlighted line's tint ends at the scrollport rather than at the block's width. Its notes share the column and position sticky, so that fix wants its own change.Thanks to @leaf-agent for both review findings — the untested containment and the degenerated probe.