Repository navigation
Show a diff file's whole path only where its row cuts it short - #1959
Merged
Merged
Conversation
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]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
reviewed
Oct 7, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
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]>
leaf-agent
approved these changes
Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#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) inlf-diff.jswatches 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, sincescrollWidthrounds to whole pixels and Chrome draws the ellipsis for an overflow of a tenth of a pixel. While cut, the row wearsdata-path-cut, and every rule in the diff package'sshadow.cssthat 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-statecontainer 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
titlefollows 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.src/summary.rs. The column is now the review press alone, or both across the bar's gap where the file has both.walkthrough-path-keyboardstills driver picks its row bydata-path-cut.Tests
test_a_file_row_says_its_whole_path_to_the_keyboard_and_a_held_fingeralso 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_pathchecks 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.