Skip to content

Pin open file headers in the diff viewer - #161

Merged
0101 merged 7 commits into
mainfrom
diff-viewer-sticky-file
Aug 3, 2026
Merged

Pin open file headers in the diff viewer#161
0101 merged 7 commits into
mainfrom
diff-viewer-sticky-file

Conversation

@0101

@0101 0101 commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Problem

  • Long patches scroll their file header out of view, removing the visible file path and change context while reading.

Fix

  • Keep the expanded .file-heading pinned below the sticky change summary while its own .file-item remains visible.
  • Share the summary offset through --summary-height, preserve the correct stacking order, and add an opaque background and divider for the pinned row.
  • Document the behavior in docs/spec/worktree-diff-viewer.md.
  • Add browser coverage for pinning, stacking, release at the file boundary, and avoiding overlap with the following file.

Tests

  • dotnet test src\Tests\Tests.fsproj --filter "Name~pins" --no-restore

0101 and others added 5 commits July 30, 2026 12:41
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
Copilot AI balanced review requested due to automatic review settings July 31, 2026 15:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

@0101
0101 merged commit a9aebb3 into main Aug 3, 2026
1 check passed
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