-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Problem
In large multi-file reviews, mouse-wheel / trackpad scrolling can reveal diff sections that stay in the plain-text fallback until some other navigation action happens.
Examples that seem to wake highlighting back up:
- change hunk (
[/]) - page navigation (
Space,PgUp,PgDn) - other focus-changing navigation paths
The result is that syntax highlighting feels inconsistent depending on how you arrived at a region.
Current implementation notes
A few places look relevant:
src/ui/components/panes/DiffPane.tsx- computes
visibleViewportFileIds - decides which files get
shouldLoadHighlight
- computes
src/ui/diff/useHighlightedDiff.ts- only starts async highlighting when
shouldLoadHighlightbecomes true
- only starts async highlighting when
src/ui/components/panes/DiffSection.tsx- passes
shouldLoadHighlightintoPierreDiffView
- passes
There is already infrastructure for viewport-aware loading and prefetching, but the wheel/trackpad path does not seem to produce the same highlighting behavior as hunk/page navigation in practice.
There is also existing scroll coverage in test/ui-scroll-regression.test.tsx, so this should be testable at the pane/app level.
Desired behavior
When mouse scrolling reveals a new file or hunk in the review stream, syntax highlighting should begin loading for that newly visible content without requiring an additional keyboard navigation step.
Acceptance criteria
- Mouse-wheel / trackpad scrolling into a new visible file starts highlight loading for that file.
- Highlight behavior is consistent across:
- mouse scrolling
- hunk navigation
- page navigation
- Already-cached highlights still render immediately when revisiting a file.
- Add a regression test that reproduces the mouse-scroll path specifically.
Notes
This is a UX consistency issue more than a pure perf issue: the content is visible, so users expect it to behave the same regardless of which navigation path got them there.