Skip to main content

Module line_diff

Module line_diff 

Source
Expand description

Line-level hunk diff โ€” a faithful port of line-diff.ts.

The originals roll their own LCS with a load-bearing tie-break (lcs[i+1][j] >= lcs[i][j+1] โ‡’ prefer removed); we port it directly so the emitted op stream matches byte-for-byte. Hunks expand context_lines around each change and merge when adjacent.

Functionsยง

build_line_hunks
Build line-level hunks between two texts, with context_lines of context around each change. Returns an empty vec when the texts are identical.
build_line_hunks_default
Convenience matching the TS default of 3 context lines.