Skip to main content

Module refine

Module refine 

Source
Expand description

DR.1 (2026-08-12): intra-line refinement — which part of a changed line changed.

Design: docs/dev/architecture/diff-refinement.md. Slice plan: docs/dev/operations/slice-plans/diff-refinement.md.

Every diff surface colours a changed line uniformly, so a one-character change reads exactly like a rewritten one. This computes the byte ranges that actually differ between a removed line and the added line that replaced it; the presentation layers (DR.2–DR.4) tint those ranges more strongly.

Pure and consumer-agnostic. It lives here rather than in lattice-magit because diff-mode’s side-by-side panes have the identical gap — magit is the first consumer, not the owner.

§Word-level, deliberately

Character-level diffing of source code produces confetti: matching brackets and single letters scatter through a rename and read worse than no refinement at all. Word-level is what magit, delta and GitHub use.

Structs§

RegionRefinement
The byte ranges that differ, per line, on each side of one hunk.

Functions§

refine_regions
Refine one hunk’s removed region against its added region.