Skip to main content

Module diff

Module diff 

Source
Expand description

Unified diff formatting with ANSI colors.

Provides format_colored_diff as the single canonical implementation for rendering diff hunks with terminal colors. Previously duplicated in vtcode-core and vtcode-ui.

Structs§

DiffBundle
A diff rendered with both structured hunks and formatted text.
DiffHunk
A diff hunk with old/new ranges and semantic lines.
DiffLine
A source line and its old/new positions.
DiffOptions
Options retained for the legacy vtcode_commons::diff API.
DiffPalette
Foreground accents and background for one diff theme.

Enums§

Chunk
A contiguous borrowed character-level diff chunk.
DiffLineKind
The semantic role of a line inside a hunk.
DiffTheme
Named diff color themes with WCAG AA-checked accents.

Functions§

compute_diff
Compute a diff through the extracted implementation while preserving the legacy options type.
compute_diff_chunks
Computes a character-level diff with adjacent chunks coalesced.
compute_diff_with_theme
Compute a structured diff bundle using the default theme-aware formatter.
format_colored_diff
Format diff hunks with standard ANSI colors for terminal display.
format_colored_diff_with_theme
Format diff hunks with the colors of a selected diff theme.
format_unified_diff
Format a unified diff without ANSI color codes.