Skip to main content

Module diff

Module diff 

Source
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§

DiffLineKind
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 to Context.

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 to Context so the renderer’s match stays exhaustive without panicking.