Expand description
Pending synthetic-buffer highlights mechanism (MG.2).
A shared service that decouples async refresh tasks (e.g. magit status buffer rebuild) from the Editor’s tick drain. The async task:
- Computes per-line
StyledSpanvectors. - Stores them in
mapkeyed byBufferId. - Fires
waker(the Editor’sasync_landedNotify).
On the next tick, Editor::drain_pending_synthetic_highlights drains
the map into each buffer’s ExtraHighlights BufferLocal.
Uses only tokio for the waker; lattice-cells / lattice-core for
the span and buffer-id types. No host or mode dependencies.
Structs§
- Highlights
Update - One op’s worth of published highlighting — foreground spans plus, optionally, intra-line diff refinement (DR.3, 2026-08-12).
- Pending
Synthetic Highlights - Shared state between async refresh tasks and the Editor’s tick drain.
Enums§
- Highlights
Op - Entry in the pending highlights map: a full replacement, or a splice (insert or remove) that shifts every subsequent line’s spans to stay aligned with a text edit that inserted/removed lines at the same position.
Functions§
- splice_
insert - Splice
spansintobaseatstart_line, shifting everything at or afterstart_linedown byspans.len(). Pulled out as a pure function (rather than inlined at the drain call site) so the line-offset arithmetic — the exact thing that regressed into an in-place overwrite once already — has its own unit tests. DR.3: generic over the span type so foreground spans and intra-line refinement are shifted by ONE implementation. Two copies of this arithmetic is precisely how the two lists drift apart. - splice_
remove - Remove
countlines frombasestarting atstart_line, shifting everything after them up bycount. Exact inverse ofsplice_insert.
Type Aliases§
- Pending
Synthetic Highlights Handle - The shared handle a producer keeps (e.g. in its Guard or a spawned task).