Expand description
Unified-diff parsing + whitespace/formatting filters.
Pure data model — no terminal I/O, no ratatui rendering. Consumed by the git TUI overlay (rendering wired in a follow-up task).
Structs§
- Diff
Document - One parsed unified-diff document: zero or more
DiffFileentries. - Diff
File - One file in a
DiffDocument. - Diff
Line - One line inside a
Hunk. The text DOES NOT include the leading+/-/prefix character. - Hunk
- One hunk header (
@@ -old,count +new,count @@) plus its lines.
Enums§
- Diff
Line Kind - Role of a single
DiffLine. - Diff
View Mode - View mode for the rendered diff. Orthogonal to
WhitespaceMode— both live on the sameDiffDocumentand can be applied independently. - Whitespace
Mode - Whitespace / formatting filter mode for
filter_whitespace.
Functions§
- filter_
whitespace - Filter a
DiffDocumentbyWhitespaceMode. Returns a new document; hunks that survive filtering keep their text but may have their line kinds rewritten (Added/Removed → Context). Hunks that are fully demoted keep all their lines — only the kind changes. - parse_
unified_ diff - Parse a
git diffoutput into aDiffDocument.