Skip to content

fix(inline): preserve syntax fg on added text in diff1_inline#171

Merged
dlyongemallo merged 1 commit into
mainfrom
inline_addition_highlight
May 15, 2026
Merged

fix(inline): preserve syntax fg on added text in diff1_inline#171
dlyongemallo merged 1 commit into
mainfrom
inline_addition_highlight

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings May 15, 2026 06:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts diff1_inline intraline-added highlighting so added text preserves syntax foreground colors by switching from DiffviewDiffText to a new DiffviewDiffAddInline highlight group (bg/style only).

Changes:

  • Switch intraline “added range” extmarks in diff1_inline rendering to use DiffviewDiffAddInline.
  • Add/derive the new DiffviewDiffAddInline highlight group from DiffviewDiffAdd while omitting fg.
  • Update functional tests to look for the new extmark highlight group and add a highlight-definition test.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
lua/diffview/tests/functional/inline_diff_spec.lua Updates extmark expectations to DiffviewDiffAddInline and adds a highlight inheritance test.
lua/diffview/scene/inline_diff.lua Changes intraline added-span extmarks to use DiffviewDiffAddInline.
lua/diffview/hl.lua Simplifies hi_link() relinking behavior and introduces/updates derived diff highlight groups including DiffviewDiffAddInline.
Comments suppressed due to low confidence (2)

lua/diffview/tests/functional/inline_diff_spec.lua:351

  • This overleaf test now asserts DiffviewDiffAddInline extmarks, but the test name/message above still says “DiffText”. Update the wording to match the new highlight group so failures are easier to interpret.

      local ranges = char_ranges(extmarks(bufnr))
      assert.is_true(#ranges > 0, "expected DiffviewDiffAddInline extmarks on added chars")
    end)

lua/diffview/tests/functional/inline_diff_spec.lua:946

  • In this helper the highlight group filter was updated to DiffviewDiffAddInline, but several assertion messages in this describe block still mention “DiffText”. Consider updating those strings to the new group name to avoid confusion when diagnosing failures.
      local out = { hl = 0, inline = 0 }
      for _, m in ipairs(marks) do
        local d = m[4]
        if d.hl_group == "DiffviewDiffAddInline" then
          out.hl = out.hl + 1

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/diffview/tests/functional/inline_diff_spec.lua
Comment thread lua/diffview/tests/functional/inline_diff_spec.lua Outdated
Comment thread lua/diffview/hl.lua Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@dlyongemallo dlyongemallo force-pushed the inline_addition_highlight branch from f964efc to 722574a Compare May 15, 2026 08:00
@dlyongemallo dlyongemallo force-pushed the inline_addition_highlight branch from 722574a to a947fe5 Compare May 15, 2026 21:42
@dlyongemallo dlyongemallo merged commit 1a6d76d into main May 15, 2026
7 checks passed
@dlyongemallo dlyongemallo deleted the inline_addition_highlight branch May 15, 2026 21:48
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.

2 participants