fix(highlight,parser,init): line_hl_group, clear_end, did_filetype, email-quoted diffs

Problem: line backgrounds used `hl_group + end_row` multirow extmarks
vulnerable to adjacent `clear_namespace`. `clear_end` was off by one.
`vim.filetype.match` returned nil for function-handled extensions
(`.sh`, `.bash`, etc.) when `did_filetype() != 0`. Parser didn't
handle email-quoted diff prefixes (`> `).

Solution: use `line_hl_group` single-point extmarks. Fix `clear_end`
to `hunk.start_line + #hunk.lines`. Override `vim.fn.did_filetype`
via `rawset` during retry. Strip `> ` quote prefixes in parser and
store `quote_width` per hunk.
This commit is contained in:
Barrett Ruth 2026-03-04 17:29:19 -05:00
parent 0f0acacf96
commit 13c0ea1e92
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
9 changed files with 552 additions and 52 deletions

View file

@ -765,7 +765,7 @@ local function init()
if not entry.highlighted[i] then
local hunk = entry.hunks[i]
local clear_start = hunk.start_line - 1
local clear_end = clear_start + #hunk.lines
local clear_end = hunk.start_line + #hunk.lines
if hunk.header_start_line then
clear_start = hunk.header_start_line - 1
end
@ -799,7 +799,7 @@ local function init()
}
for _, hunk in ipairs(deferred_syntax) do
local start_row = hunk.start_line - 1
local end_row = start_row + #hunk.lines
local end_row = hunk.start_line + #hunk.lines
if hunk.header_start_line then
start_row = hunk.header_start_line - 1
end
@ -953,6 +953,7 @@ M._test = {
invalidate_cache = invalidate_cache,
hunks_eq = hunks_eq,
process_pending_clear = process_pending_clear,
ft_retry_pending = ft_retry_pending,
}
return M