Skip to main content

Module patch

Module patch 

Source
Expand description

Patch application for round-trip testing.

Given a HunkIndex produced by [compute_two_way(a, b)] and the original ropes a + b, apply_two_way applies the hunks to a to produce a result equivalent to b. This is the primitive that drives the property test apply(diff(a, b), a) == b for randomly-generated rope pairs.

Not the public surface for editing — production hunk transfer (do / dp) lands in D.5 and routes through the standard edit pipeline rather than this helper.

Functions§

apply_two_way
Apply a two-way HunkIndex produced by compute_two_way(a, b) to a, reading replacement content from b. The result equals b (this is the round-trip invariant the property tests assert).