Expand description
Diff rendering for tool results — colored +/-/ lines with
intra-line word-diff highlighting.
Port of the TypeScript renderDiff
(packages/coding-agent/.../components/diff.ts).
The edit tool already produces a display-oriented diff string in
result.details.diff (lines shaped +123 … / -123 … / 123 …;
see rpi-tools/src/tools/edit_diff.rs::generate_diff_string). This module
consumes that string (no generator, no rpi-tools dependency) and renders
it as ANSI-styled terminal lines:
- removed (
-) → red (theme.colors.error) - added (
+) → green (theme.colors.success) - context (
) → muted/dim (theme.colors.muted) - for a single removed→added pair, the changed words are inverse-highlighted so you can see what moved within the line.
Functions§
- render_
diff - Render a display-diff string into styled terminal lines.