Skip to main content

diff

Function diff 

Source
pub fn diff(base: &str, new: &str) -> Delta
Expand description

Char-level Myers/LCS diff over USV: a minimal Retain / Delete / Insert script. Disjoint edits stay separate ops rather than collapsing the span between them into one delete+insert, so anchors sitting in unchanged middle text survive rebase without relying on the move detector.

Single-line text diffs at char granularity; multi-line text diffs at line granularity so a paragraph reorder surfaces as whole-line insert spans the move detector can match (char Myers fragments reordered blocks). Above CHAR_DIFF_LIMIT chars, the single-line path skips Myers entirely and uses coarse_replace instead.