refactor(highlight): unified per-line extmark builder #144
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
barrettruth/diffs.nvim!144
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refactor/highlight-hunk-extmark-builder"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
highlight_hunkapplied DiffsClear extmarks across 5 scattered sites withad-hoc column arithmetic. This fragmentation produced the 1-column DiffsClear
gap on email-quoted body context lines (#142 issue 1). A redundant
highlight_hunk_vim_syntaxfunction duplicated the inline vim syntax path,and the deferred pass in init.lua double-called it, creating duplicate scratch
buffers and extmarks.
Solution
Reorganize
highlight_hunkinto two clean phases:grammar, header context text). Sets syntax extmarks only, no DiffsClear.
intra-line). All non-syntax extmarks consolidated in one pass.
Hoist
new_codeto function scope (needed byhighlight_textoutside theuse_tsblock). Hoistat_raw_lineso Phase 1d and Phase 2b share onenvim_buf_get_linescall.Delete
highlight_hunk_vim_syntax(redundant with inline path). Remove thedouble-call from the deferred pass in init.lua.
Extend body prefix DiffsClear
end_colfromqwtopw + qw, fixing the1-column gap where native treesitter background bled through on context lines
in email-quoted diffs (#142 issue 1).
Email-quoted diff support
The parser now strips
>(and>>, etc.) email quote prefixes beforepattern matching, enabling syntax highlighting for diffs embedded in email
replies and
git-send-email/ sourcehut-style patch review threads.Each hunk stores
quote_widthso the highlight pipeline can applyDiffsClearat the correct column offsets to suppress native treesitteron quoted regions.
Closes #141
#142 status after this PR
>context lines