Skip to content

Show a diff file's whole path only where its row cuts it short - #1959

Merged
max-sixty merged 6 commits into
mainfrom
agent-a0054148366208fdf
Oct 7, 2026
Merged

max-sixty merged 6 commits into
mainfrom
agent-a0054148366208fdf

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

#1902 added a box under a diff file's row that shows the whole path while the keyboard stands on the row or a press is held on it. It showed on every row, so a path the row shows whole read twice. It now shows only on a row that cuts its path short, and follows the row's width as the window resizes.

How a row knows it cuts its path

One sizeObserver (runtime/rendering.js) in lf-diff.js watches the path's two parts, the folders and the file's name, on every file row the diff keeps: from when a row becomes its file's row until a revision replaces it. Whether the row cuts the path changes only with their widths: a new window width, face, or press column. A delivery reads every row it names before writing any; a part counts as cut where a Range over its words is wider than its box, since scrollWidth rounds to whole pixels and Chrome draws the ellipsis for an overflow of a tenth of a pixel. While cut, the row wears data-path-cut, and every rule in the diff package's shadow.css that draws the box or lets it out of the row's clip requires it. A row that leaves the page stays observed and is collected with its observation; measured in Chrome, 2000 observed, detached rows return the node count to its baseline after a forced collection.

CSS alone can't read this: scroll-state container queries aren't in WebKit, and a container query can't style the box that holds it.

A row showing its whole path keeps the hold gesture, so releasing a long press still folds the file.

The same cut, read by a pointer and by the room beside the path

  • The path's title follows the same reading: it is set only while the row cuts the path, so a mouse resting on a short path no longer gets a tooltip repeating it. Rename rows wrap rather than cut, so they have no title.
  • A file with a review press held open room for a comment press too, whether or not it had one. An inline patch under review has none, so on a 390px phone its row kept 184px of padding for a 110px bar and cut a path as short as src/summary.rs. The column is now the review press alone, or both across the bar's gap where the file has both.
  • The walkthrough-path-keyboard stills driver picks its row by data-path-cut.

Tests

  • test_a_file_row_says_its_whole_path_to_the_keyboard_and_a_held_finger also checks that a short row shows no box and has no title, and that a focused long row loses both when the window widens past its path and gets them back when it narrows. Stopping the observer once a row reads cut fails it.
  • test_a_phone_keeps_the_diff_file_name_and_the_sticky_header_height (WebKit) checks that the row's padding is the press bar's width with its gaps.
  • test_a_file_row_a_revision_brings_reads_its_cut_path checks that a row a revision brings, a rename turned into a changed file with a long path, inline and as a manifest, wears the mark and the title. Dropping the watch where a revision replaces a row fails it.

Is there a more underlying fix?

Yes, and this PR makes it: the path's title and the room beside the path were the same defect by other routes, and both are fixed above. An independent reviewer compared the mark with the ellipsis actually drawn across widths 320–1490px, zoom levels, device pixel ratios, font swaps, hidden-then-shown diffs and WebKit, and found no mismatch.

Still open, and older than this change: in print, the presses are hidden but their room is still held open, and a path cut on paper can't be read whole.

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

max-sixty and others added 5 commits October 6, 2026 04:33
The box under a diff file's row, shown while the keyboard stands on the row
or a press is held on it (#1902), showed on every row, so a path the row
shows whole read twice. The row now wears `data-path-cut` while it cuts its
path short, and every rule that draws the box or lets it out of the row's
clip requires it.

A size observer on the path's two parts, the folders and the file's name,
keeps the mark current: whether the row cuts the path changes only with
their widths, at a new window width, face or press column. A part counts as
cut where a Range over its words is wider than its box. `scrollWidth`
rounds to whole pixels, and Chrome draws the ellipsis for an overflow of a
tenth of a pixel.

A row showing its whole path keeps the hold gesture, so releasing a long
press still folds the file.

`test_a_file_row_says_its_whole_path_to_the_keyboard_and_a_held_finger` now
also checks that a short row shows no box, and that a focused row's box
goes when the window widens past its path and returns when it narrows.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Every file path in a diff carried the whole path as its title, so a pointer
resting on a path the row shows whole, or on either side of a rename, which
wraps rather than cutting, got a tooltip repeating it. The title is the
pointer's reading of the same cut the keyboard and a held press read, so
the observer that marks a cut row now sets the path's title too, and clears
it when the row widens past the path. Rename rows have no title.

The whole-path test now also checks the title on a short row, and on a
long row as the window widens and narrows.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A file with a review press held open room for a comment press beside it,
whether or not the file had one. An inline patch under review has no comment
press, so on a 390px phone its row kept 184px of padding for a 110px bar,
and a path as short as `src/summary.rs` was cut. The column is now the
review press alone, or both across the bar's gap where the file has both.

The stills driver for `walkthrough-path-keyboard` picks its row by
`data-path-cut`, the reading the row itself wears, rather than a
whole-pixel overflow of the folders. The comments that said a row keeps the
file's name whole now say the folders give way first: a long enough name is
cut too.

`test_a_phone_keeps_the_diff_file_name_and_the_sticky_header_height` checks
that the row's padding is the bar's width with its gaps.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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.

The new watchPathCut observer survives ordinary diff revisions. renderFile builds a fresh summary and starts observing its two path spans, but replaceFileContent keeps details.firstElementChild from the prior rendering and discards the fresh summary. The observer is never disconnected, so each changed rendering of a file retains another detached header and its callback. A page that receives live patch updates accumulates these for the life of the page. Start the observer only on the header that is kept, and disconnect it when that header is replaced or removed.

Each rendering built its row with an observer of its own, but a revision
that keeps the file's row (`replaceFileContent`) discards the fresh
rendering's row, so its observer watched a row never shown. One observer
now watches every file's row, from when the row becomes its file's row
(`fileRow`, `replaceFileRendering`) until another replaces it, and a
delivery reads every row it names before writing any.

A row that leaves the page with its file or diff stays observed: an
observer holds its targets weakly. Measured in Chrome, 2000 observed,
detached rows return the node count to its baseline after a forced
collection, with one long-lived observer as with one per row; holding the
same rows from a script keeps all 6000 nodes.

`test_a_file_row_a_revision_brings_reads_its_cut_path` covers a revision
that turns a rename into a changed file with a long path, inline and as a
manifest: the new row wears `data-path-cut` and the path's title. Dropping
the watch in `replaceFileRendering` fails it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit e6859a7 into main Oct 7, 2026
4 checks passed
@max-sixty
max-sixty deleted the agent-a0054148366208fdf branch October 7, 2026 04:56
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