feat: support email-quoted diffs #149

Merged
barrettruth merged 2 commits from feat/email-quoted-diffs into main 2026-03-05 15:31:19 +00:00
barrettruth commented 2026-03-05 15:29:24 +00:00

Problem

Email-quoted diffs (> diff --git ..., > @@ ...) from git-send-email / email reply workflows produce 0 hunks because the parser matches patterns against raw lines containing > quote prefixes. Closes #141.

Solution

Strip the > quote prefix before pattern matching in the parser. Store quote_width on each hunk. In highlight.lua, offset all extmark column positions by qw and expand pw > 1 guards to qw > 0 or pw > 1 for DiffsClear suppression. Clamp body prefix DiffsClear end_col to the actual buffer line byte length for bare > lines (1-byte buffer lines where end_col = pw + qw would exceed bounds and cause nvim_buf_set_extmark to silently fail inside pcall).

15 new specs covering parser detection, stripping, false-positive rejection, and highlight column offsets including the bare > clamp edge case.

## Problem Email-quoted diffs (`> diff --git ...`, `> @@ ...`) from git-send-email / email reply workflows produce 0 hunks because the parser matches patterns against raw lines containing `> ` quote prefixes. Closes #141. ## Solution Strip the `> ` quote prefix before pattern matching in the parser. Store `quote_width` on each hunk. In `highlight.lua`, offset all extmark column positions by `qw` and expand `pw > 1` guards to `qw > 0 or pw > 1` for DiffsClear suppression. Clamp body prefix DiffsClear `end_col` to the actual buffer line byte length for bare `>` lines (1-byte buffer lines where `end_col = pw + qw` would exceed bounds and cause `nvim_buf_set_extmark` to silently fail inside `pcall`). 15 new specs covering parser detection, stripping, false-positive rejection, and highlight column offsets including the bare `>` clamp edge case.
Sign in to join this conversation.
No description provided.