Skip to content

Collapse unchanged regions with incremental expand-context #21

@geevensingh

Description

@geevensingh

Summary

Collapse the unchanged lines between hunks into a foldable region, with affordances to reveal more context incrementally (e.g. "expand 10 lines up/down", "expand all"). This is standard in GitHub's "Files changed" view, VS Code's diff editor, and Sublime Merge.

Motivation

DiffViewer renders full file context around hunks today. For large files with small changes, the reader scrolls through long stretches of identical text. We have a hunk overview bar and F7/F8 hunk navigation, but no inline way to shrink the unchanged gaps or progressively reveal them.

This is pure diff-reading ergonomics — squarely on-mission ("a better diff viewer") with no scope creep toward merge-tool / git-client territory.

Competitive context

Came out of a competitive review against Beyond Compare, WinMerge, Meld, Sublime Merge, VS Code, GitHub/GitLab PR views, and difftastic. This was triaged as a strong-fit gap: cheap, high daily value, on-mission.

Sketch of scope

  • Render collapsed placeholders for unchanged runs longer than the existing context window (the diff already carries leading/trailing context lines per hunk).
  • Click / keyboard affordances to expand by N lines, and to expand the whole gap.
  • Works in both side-by-side and inline modes.
  • Interplay with the hunk overview bar and F7/F8 navigation should be considered (collapsed gaps shouldn't break hunk stepping).
  • Consider a toolbar/setting toggle and whether the collapsed state should persist.

Out of scope

  • Any merge / conflict-resolution behavior.
  • Changing the underlying diff algorithm.

Filed from a competitive-research session; design + plan to follow before implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions