Skip to content

fix: start a diff's highlighting over at each gap - #5

Merged
omartelo merged 1 commit into
mainfrom
fix/highlight-across-gaps
Oct 23, 2026
Merged

omartelo merged 1 commit into
mainfrom
fix/highlight-across-gaps

Conversation

@omartelo

Copy link
Copy Markdown
Contributor

Summary

A DiffView highlighted all its rows as one text, gap separators included. A block comment opened above a gap and closed in the lines it leaves out ran on as a comment through every hunk below, up to the next */ on screen. Expanding the gap fixed the colors, since the */ then appeared.

Now the rows between gaps are highlighted on their own (highlightApart), using the separator rows as breaks. No exported API changes: the breaks ride an unexported Content field that only DiffView sets.

A diff with gaps is parsed from scratch each time instead of reparsed incrementally. Once every gap is filled it goes back to the incremental path.

The remaining limits (a comment cut by a gap colors as code above it; interleaved deleted and added rows in unified) are in docs/ceilings.md and tracked in #4.

Test plan

  • TestAGapEndsWhatItsHunkLeftOpen (unified and split) fails without the fix and passes with it
  • gofmt -l ., go vet ./..., go test ./...
  • go test -race -count=50 on the gap tests
  • Headless demo shot of a Java patch with a doc comment cut by a gap

A block comment opened above a gap and closed in the lines it leaves out ran
on as a comment through the following hunks, up to the next "*/" on screen.
The rows between gaps are now highlighted on their own.
@omartelo
omartelo merged commit 12317c4 into main Oct 23, 2026
1 check passed
@omartelo
omartelo deleted the fix/highlight-across-gaps branch October 23, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant