Skip to content

Use add/delete line highlights and highlight full line width - #15

Merged
ryutaro-asada merged 1 commit into
mainfrom
fix/line-add-delete-highlights
Oct 22, 2026
Merged

ryutaro-asada merged 1 commit into
mainfrom
fix/line-add-delete-highlights

Conversation

@ryutaro-asada

Copy link
Copy Markdown
Owner

Closes #13.

Summary

  • Add/delete line groups: pure insertions (empty original range) now get PartialDiffLineAdd on the To side, and pure deletions (empty modified range) get PartialDiffLineDelete on the From side. Only modified blocks use PartialDiffLineChange. The line_add / line_delete options were configurable but never used.
  • Full-width line highlights: line highlights use line_hl_group instead of an extmark spanning column 0..#line. Empty added/deleted lines are now visible, and the highlight extends to the window edge like diff mode. Move highlights use the same helper, so they're full width too.
  • Fallback diffopt: when the vscode-diff call fails inside apply_diff_highlights, diff.fallback_diffopt is applied (and restored on close), same as the regular fallback path.

Testing

  • make test: 41/41 pass locally (Neovim 0.11.1).
  • New tests: inserted lines → add group, deleted lines → delete group, modified lines → change group on both sides, inserted/deleted empty lines highlighted, full-width line_hl_group, fallback diffopt on vscode-diff failure.
  • Against the previous implementation, 5 of the 6 new tests fail. The one that passes is "change group for modified lines", which the old code already did.
  • Test helpers now also read line_hl_group, so the existing move/line assertions keep checking the same thing.
  • CI (0.10.4 / stable): see checks.

- Pure insertions (empty original range) now use PartialDiffLineAdd on the
  To side and pure deletions use PartialDiffLineDelete on the From side;
  only modified blocks use PartialDiffLineChange. line_add/line_delete
  were configurable but never used.
- Line highlights use line_hl_group instead of a 0..#line column range,
  so empty added/deleted lines are visible and the highlight spans the
  window width like diff mode.
- When the vscode-diff call fails inside apply_diff_highlights, apply
  diff.fallback_diffopt like the regular fallback path does.

Closes #13
@ryutaro-asada
ryutaro-asada merged commit 18eaa4b into main Oct 22, 2026
2 checks passed
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.

Use line_add/line_delete highlights and highlight empty added/deleted lines

1 participant