Skip to content

PR Files Changed should highlight only the changed tokens on modified lines, not the whole line #961

Description

@Dexterity104

Problem

When a pull request changes a single token on a long line, the renderer in src/components/prs/PRFilesChanged.tsx paints the entire line red on the left and the entire line green on the right. Reviewers then have to compare both copies of the line side by side just to find the characters that actually changed.

Context

The renderer already pairs the left and right halves of modified lines. The split view's row builder carries { type: 'modify'; left: Change | null; right: Change | null } exactly for this case, so the pairing work is done.

Proposal

Add an inline word diff on those paired rows so only the tokens that actually changed are highlighted. A small in-file LCS pass, or a pull of diffWords from the diff package, fits without restructuring the viewer. The Unified view benefits from the same change since it walks the same paired rows.

This is the single biggest readability win the diff viewer can ship. It pairs naturally with the hide whitespace toggle, lives entirely client side, and matches what reviewers expect from GitHub's own diff UI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions