Expand description
D.4.c (2026-05-29) / D.6.b (2026-05-31): hunk-alignment filler rows.
FillerRowProvider is a [VirtualRowProvider] that
emits blank virtual rows on whichever side of a
side-by-side diff is shorter for a given hunk, so the
hunks align visually across all panes.
Composes with D.4.a (crate::pane_group), D.4.b
(crate::pane_group), and D.0a virtual rows
([lattice_cells::VirtualRowProvider]); consumed by
D.4.d (:diffsplit / :diffthis two-way) and D.6.c
(three-way :diffsplit base remote).
See docs/dev/architecture/diff-system.md §5.2.
§One provider per pane
A side-by-side session has N panes (2 in two-way, 3 in
three-way), each showing a different buffer. Filler
rows for a pane depend on that buffer’s row coordinates;
the virtual-rows worker is per-document
(docs/dev/architecture/virtual-rows.md §1), so we
register one provider per pane, each parameterised by
Side.
§Algorithm
For each hunk in the session’s published HunkIndex,
given the pane’s Side:
- Let
lens[i] = hunk.ranges[i].len()for each participating side. - Let
max_len = max(lens). - This pane’s
this_len = lens[side.pane_index()]. - Emit
max_len - this_lenfiller rows on this pane (zero when this pane is already the longest). - Anchor: if
this_len == 0(this pane has no lines in this hunk), anchor atrange.startwith [AnchorPosition::Above] — fillers paint immediately before the insertion point. Ifthis_len > 0, anchor atrange.end - 1with [AnchorPosition::Below] — fillers paint after the last changed line so the rest of the buffer aligns.
Conflict hunks: in two-way (ranges.len() == 2) they
shouldn’t be emitted by compute_two_way, so the
provider defensively skips them. In three-way
(ranges.len() >= 3) Conflict hunks have the same
row-geometry as Change for alignment purposes, so they
contribute fillers normally.
Structs§
- Filler
RowProvider - D.4.c: one provider per
(session, side)pair.
Enums§
- Side
- Which pane of a side-by-side session this provider
emits rows for. Each variant maps to a slot index in
Hunk::ranges:
Functions§
- compute_
filler_ rows - Pure function from
(HunkIndex, side)to filler rows. Exposed for direct unit testing without round-tripping through aDiffSession. - diff_
filler_ provider_ id - D.4.c: deterministic [
ProviderId] for the filler-row provider onbuffer_idandside. Exposed as a free function so:diffoff/ D.4.d teardown can unregister without holding the provider — the namespace encoding makes the id reproducible.