pub struct VirtualRow {
pub anchor_line: u32,
pub position: AnchorPosition,
pub cells: Arc<[Cell]>,
pub height: u16,
pub kind: VirtualRowKind,
pub bg: Option<u32>,
pub scales: Option<Arc<[u16]>>,
pub media: Option<MediaBlockRef>,
pub gutter_line: Option<u32>,
pub gutter_fg: Option<u32>,
}Expand description
One virtual row’s anchor + content.
anchor_line is the 0-based source line this row attaches
to. position selects Above or Below the anchor.
cells is the rendered row content – same Arc<[Cell]>
shape that backs a document crate::CellRow, so
renderers can paint virtual rows through the same fast
path with no special casing.
height is the row’s vertical span in matrix-row units
(1 for the common case; values > 1 reserved for
multi-line code-lens / signature-preview blocks that paint
taller than one cell row).
kind (D.6.i) tags the row’s provenance so renderers
pick the right backdrop / decoration treatment without
guessing from cell content.
bg overrides the kind-based default background when
Some(rgb_u32) (0xRRGGBB). None → renderer picks from
kind (deletion-block red for DeletionBlock/Generic,
transparent for Filler/Sticky).
Fields§
§anchor_line: u32§position: AnchorPosition§cells: Arc<[Cell]>§height: u16§kind: VirtualRowKind§bg: Option<u32>§scales: Option<Arc<[u16]>>F.3 (Thread F): per-display-column font scale in
hundredths (100 = 1.0×, the base size), parallel to
Self::cells by display column. None ⇒ the whole row
is base size (the common case — zero cost, no allocation).
This extends the variable-font commitment (per-token
scaling, the emacs markdown-heading model — only the title
scales, not the leading markers) from document rows to
virtual rows. A renderer coalesces contiguous equal scales
into runs (mirroring how it coalesces per-cell fg), shapes
each run at font_size × scale/100 on a shared baseline,
and grows the row height to the tallest run. The dashboard
branding block (DB.4-gpui) is the first consumer: the
“Lattice” wordmark scales while the mark blocks stay base.
The GPUI peer honors it; the TUI peer ignores it (a terminal
cell grid cannot vary font size). When present, its length
matches cells; a shorter/absent entry defaults to 100.
media: Option<MediaBlockRef>IM.3: the media block this row belongs to, when
kind is
MediaBlock.
Shared across every row of a group, so a renderer that meets any row
of the block can paint the whole thing without reassembling it from
the cells. None for every other kind — one Option<Arc> per row,
which is what scales already costs.
gutter_line: Option<u32>TC.8: the SOURCE line this row should show in its gutter (0-based;
renderers add one, as they do for document rows). None — the default
for every kind — paints the blank gutter virtual rows have always had.
Deliberately separate from Self::anchor_line. Anchoring answers
“where does this row sit”; this answers “what number does it show”, and
for most virtual rows the honest answer is nothing: a deletion block
has no current-side line, and a filler row has no line at all. A sticky
context row is the case where the two differ in the other direction —
it is anchored above the viewport but shows its own place in the file.
It is a field rather than a renderer-side match vrow.kind because the
renderers must not branch on kind: any producer that knows a real line
number can set this and get the document gutter for free.
gutter_fg: Option<u32>TC.11: foreground for Self::gutter_line’s digits (0xRRGGBB).
None — the default — leaves the renderer’s own gutter colour, which
is what document rows use.
Trait Implementations§
Source§impl Clone for VirtualRow
impl Clone for VirtualRow
Source§fn clone(&self) -> VirtualRow
fn clone(&self) -> VirtualRow
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more