Skip to main content

Module overlay

Module overlay 

Source
Expand description

D.3.a (2026-05-29) — DiffOverlayVirtualRowProvider.

Bridges crate::subsystem::DiffSession’s published HunkIndex to the virtual_rows_worker’s [lattice_cells::VirtualRowProvider] surface. One provider per active diff session; registered with Editor::virtual_row_providers at session-open time (D.3.a.1’s :diff ex-command) and unregistered at :diffoff.

§What this slice (D.3.a) emits

For each Remove or Change hunk in the session’s published HunkIndex, one Above-anchored [VirtualRow] per baseline line the hunk deletes / replaces. The anchor is the current side’s start line for the hunk — so the deletion block appears immediately above the corresponding edit position in the buffer the user is looking at. Add hunks emit nothing (the added lines are visible in the current buffer; the future gutter sign / background tint passes — D.3.d / D.3.e — visualise the add). Conflict hunks are emitted like Change for v1; the three-way merge slice (D.6) refines the rendering.

§What this slice does NOT emit

  • No cell content in the deletion-block rows. D.3.a emits empty cells: Arc<[Cell]> so the virtual rows take visual space (height = 1 each) but render as blank placeholders. D.3.b lands the baseline-line text: the provider snapshots the descriptor’s baseline rope on each revision bump, caches the rendered cells, and serves them from collect().
  • No gutter signs — D.3.d.
  • No background tints — D.3.e.

§Why empty rows are still useful in D.3.a

The user can immediately see that a hunk exists at the right place — there’s a visual gap above the current line indicating “something was deleted / changed here.” The semantic plumbing (provider registration, revision tracking, wake propagation, worker recompute on hunk publish) all lights up. D.3.b adds the textual content over the same wiring.

§Versioning

version() returns the session’s currently-published HunkIndex::revision. Bumps on every successful publish through crate::subsystem::DiffSession::try_publish_if_newer; the virtual_rows_worker’s fingerprint pass picks up the change on its next wake and triggers a recompute. D.3.a.1’s :diff ex-command also wires a wake forwarder so a hunk publish fires the worker’s VirtualRowsWake directly — without it, the worker would only notice on the next publish_render_state tick.

Structs§

DiffOverlayCache
Cached rendered virtual rows. Refreshed off the worker thread by DiffOverlayRefreshTask (D.3.b) so DiffOverlayVirtualRowProvider::collect returns without blocking the virtual-rows worker.
DiffOverlayRefreshTask
D.3.b: refresh task that owns the off-worker rendering of deletion-block cells.
DiffOverlayVirtualRowProvider
One provider per active diff session.
DiffSignMap
Sparse per-line classification of the current-side rope.
SyntaxContext
D.3.b.2 (2026-05-29): the per-session syntax context the provider needs to populate Cell.fg with theme-resolved token colours.

Enums§

DiffSignKind
Per-line gutter sign kind. Renderer-facing surface for D.3.d.1 (TUI) and D.3.d.2 (GPUI sprite atlas) integrations — D.3.d.0 lands the data layer only. D.3.e (line tints) composes on top of the same classification.

Functions§

compute_baseline_diff_sign_map
D-fix.3b: derive the BASELINE-side DiffSignMap from a HunkIndex.
compute_diff_sign_map
D.3.d.0: derive a DiffSignMap from a HunkIndex.
diff_overlay_provider_id
D.3.a.1 (2026-05-29): the [ProviderId] this slice uses for a given session’s overlay provider. Exposed as a free function so :diffoff can unregister without holding the session — the namespace prefix + buffer-id encoding makes the id deterministic.