Expand description
Diff rendering shared between the file-mutating tools (write_file,
apply_patch) that PRODUCE diff output and the chat renderer that COLORS
added/removed lines. Both the marker conventions and the producer
([generate_display_diff]) live here in the render layer, so every tool that
needs a display diff shares one implementation and one format.
Enums§
- Diff
Line Kind - Classification of a diff line. The chat renderer matches on this to choose a background color.
Constants§
- DIFF_
ADDED_ MARKER - Marker for an ADDED line.
- DIFF_
REMOVED_ MARKER - Marker for a REMOVED line. Formatted as
{num:>4}{marker}{content}so the three-byte width stays aligned across line numbers up to 9,999. Lines without a matching prefix fall through toContext.
Functions§
- parse_
diff_ line - Parse one line of diff output. Lines that don’t follow the
{number}{marker}{content}shape — including malformed or truncated input — fall through toContextso the renderer’s match stays exhaustive without panicking.