Pin open file headers in the diff viewer - #161
Merged
Merged
Conversation
The diff viewer's file heading scrolled away with its patch, so a long diff gave no on-screen indication of which file was being read. The heading's containing block is already the .file-item that holds both the heading and that file's patch, so plain position: sticky pins it for exactly the right span. It offsets by the change summary's height, which both now read from one --summary-height custom property, and stacks below that summary but above the patch -- the patch follows the heading in document order and would otherwise paint over it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 41cfb953-090b-4ec9-a96e-d1d93bf3fa2b
- docs/spec/worktree-diff-viewer.md:14 - the added clause claimed line counts are always visible, contradicting the same spec's rule that the stats group is omitted for binary, symlink, and zero-count entries. - src/Tests/DiffViewerTests.fs:73 - tallPatch declared one old-side line and supplied none; git emits -0,0 for a pure prepend. - src/Tests/DiffViewerTests.fs:2027 - the single-file fixture could not reach the release boundary, so a widened containing block would still have passed. Trailing collapsed rows now give the scroller room to carry the open file past the pin line, and the test asserts the heading releases, stays inside its own item, and never overlaps the next file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 41cfb953-090b-4ec9-a96e-d1d93bf3fa2b
There was a problem hiding this comment.
Pull request overview
Pins expanded diff file headers beneath the sticky summary during scrolling.
Changes:
- Adds sticky header styling, stacking, background, and divider.
- Adds browser coverage for pinning and boundary release.
- Documents the behavior.
Show a summary per file
| File | Description |
|---|---|
src/Server/Assets/diff/viewer.css |
Implements sticky file headers. |
src/Tests/DiffViewerTests.fs |
Tests pinning, stacking, and release behavior. |
docs/spec/worktree-diff-viewer.md |
Documents pinned headers. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Balanced
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.
Problem
Fix
.file-headingpinned below the sticky change summary while its own.file-itemremains visible.--summary-height, preserve the correct stacking order, and add an opaque background and divider for the pinned row.docs/spec/worktree-diff-viewer.md.Tests
dotnet test src\Tests\Tests.fsproj --filter "Name~pins" --no-restore