-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Problem
In the multi-file review stream, it is easy to lose track of which file you are looking at because each file header scrolls off the top of the viewport like ordinary content.
Today, if you scroll partway through a file, the filename can disappear above the viewport while the rest of that file is still visible.
Desired behavior
When the current file header reaches the top of the diff pane, keep it pinned there until the rest of that file has also scrolled out of view. Once the next file takes over the viewport, replace the pinned header with the next file's header.
This should behave like sticky section headers in a document:
- partially visible file => header stays pinned
- file fully scrolled away => header disappears / yields to next file
Current implementation notes
Relevant areas:
src/ui/components/panes/DiffSection.tsx- renders the file header as a normal row above the file body
src/ui/components/panes/DiffPane.tsx- already owns cross-file scrolling and has a
position: "relative"container - already renders an overlay-style
VerticalScrollbar
- already owns cross-file scrolling and has a
That suggests this may need a top overlay derived from scroll position rather than relying on a built-in sticky-row primitive.
OpenTUI stickyScroll exists for scroll-position anchoring, but it is not the same thing as sticky section headers.
Acceptance criteria
- While any rows from file N are visible, file N's header remains visible at the top of the diff pane.
- The pinned header updates correctly when scrolling with:
- mouse wheel / trackpad
- arrow keys
- page navigation
- hunk navigation
- The pinned header should match the normal header content/styling (name + stats) without duplicating extra chrome.
- It should work in both split and stack layouts.
- Add an integration test at the pane/app level that verifies the sticky header handoff between two files.
Notes
This aligns with Hunk's review-first model: the main pane is a continuous document, but users still need persistent file context while reading through it.