fix(highlight): use multiline extmark for hl_eol with start-position clearing

Problem: single-row extmarks (`end_row = buf_line, end_col = len`) do
not trigger `hl_eol` — Neovim requires `end_row > start_row`. Line
backgrounds stopped at the last character instead of extending to the
window edge.

Solution: use `end_row = buf_line + 1, end_col = 0` for line bg
extmarks. Replace per-hunk `nvim_buf_clear_namespace` with
`clear_ns_by_start` that queries extmarks by start position only,
so adjacent hunks' trailing `end_row` is never killed.
This commit is contained in:
Barrett Ruth 2026-03-15 12:35:30 -04:00
parent eccb4785ed
commit 803e08b6d5
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
3 changed files with 65 additions and 6 deletions

View file

@ -636,10 +636,9 @@ function M.highlight_hunk(bufnr, ns, hunk, opts)
end
if opts.highlights.background and is_diff_line then
local bg_end_col = raw_len or (line_len + qw)
pcall(vim.api.nvim_buf_set_extmark, bufnr, ns, buf_line, 0, {
end_row = buf_line,
end_col = bg_end_col,
end_row = buf_line + 1,
end_col = 0,
hl_group = line_hl,
hl_eol = true,
priority = p.line_bg,