fix(highlight): make hl_eol work on background extmarks

Problem: hl_eol requires a multiline extmark to extend the background
past end-of-line. The extmark used end_col = line_len on the same
row, so it was single-line and hl_eol was effectively a no-op.

Solution: replace end_col with end_row targeting the next line so
the extmark is multiline and hl_eol takes effect. Split
number_hl_group into a separate extmark to prevent it bleeding to
adjacent lines.
This commit is contained in:
Barrett Ruth 2026-02-07 14:40:55 -05:00
parent af37d25f25
commit 011db2f8b3
2 changed files with 73 additions and 2 deletions

View file

@ -458,12 +458,17 @@ function M.highlight_hunk(bufnr, ns, hunk, opts)
if opts.highlights.background and is_diff_line then
pcall(vim.api.nvim_buf_set_extmark, bufnr, ns, buf_line, 0, {
end_col = line_len,
end_row = buf_line + 1,
hl_group = line_hl,
hl_eol = true,
number_hl_group = opts.highlights.gutter and number_hl or nil,
priority = PRIORITY_LINE_BG,
})
if opts.highlights.gutter then
pcall(vim.api.nvim_buf_set_extmark, bufnr, ns, buf_line, 0, {
number_hl_group = number_hl,
priority = PRIORITY_LINE_BG,
})
end
end
if char_spans_by_line[i] then