Skip to content

Mouse scrolling should trigger syntax highlighting for newly revealed files #111

@benvinegar

Description

@benvinegar

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
  • src/ui/diff/useHighlightedDiff.ts
    • only starts async highlighting when shouldLoadHighlight becomes true
  • src/ui/components/panes/DiffSection.tsx
    • passes shouldLoadHighlight into PierreDiffView

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersuiUser interface improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions