Skip to main content

Module edit_diff

Module edit_diff 

Source
Expand description

Diff-based edit helpers.

Structs§

Edit
A single edit operation
EditDiffError
Error during diff computation
EditDiffResult
Result of computing diffs for a set of edits

Enums§

LineEnding
Line ending type

Functions§

apply_edits_to_normalized_content
Apply multiple edits to normalized (LF) content. Validates that edits don’t overlap, are unique, and all find matches.
compute_edits_diff
Compute a unified diff between original and modified content. Returns the diff string and the first changed line number.
detect_line_ending
Detect line ending type of content
generate_diff_string
Generate a diff string from a set of edits applied to content
has_bom
Check if content starts with BOM
normalize_to_lf
Normalize content to LF line endings for diff computation
restore_line_endings
Restore original line endings
strip_bom
Strip UTF-8 BOM from content