Skip to content

Expand diff context incrementally (20 lines per click) #334

@tomasz-tomczyk

Description

@tomasz-tomczyk

Currently, clicking "Expand N unchanged lines" expands the entire gap at once and destructively merges the two adjacent hunks. For large gaps (hundreds of lines), this floods the view.

Desired behavior: Expand 20 lines per click, matching GitHub/GitLab conventions. Show directional controls (expand up / expand down) and an "expand all" option for the full gap.

Implementation approach:

  • Instead of merging two hunks via hunks.splice(prevIdx, 2, merged), insert a new context-only "bridge" hunk with the 20 expanded lines between the original hunks
  • The spacer between the bridge and the next real hunk recalculates the remaining gap naturally
  • Comments are keyed by line number (not hunk index), so they're unaffected
  • Purely frontend change in renderDiffSpacer (app.js) — no backend changes needed

Refs #320

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