Skip to main content

VirtualRow

Struct VirtualRow 

Source
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

Source§

fn clone(&self) -> VirtualRow

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VirtualRow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more