pub struct RowLayout<'a> { /* private fields */ }Expand description
A visible buffer row’s horizontal projection: byte column ↔ display cell,
with tab expansion and the horizontal collapse of every root inline fold
on the row. Built per use by FoldMap::row_layout; holds only the row’s
text (a Cow — borrowed straight off the backing when the row is stored
contiguously, owned only when it spans a chunk boundary) and copies of the
row’s folds, so it carries no derived state that could drift out of sync
with the document. Like FoldMap, it is cheap to rebuild and never
stored.
Implementations§
Source§impl<'a> RowLayout<'a>
impl<'a> RowLayout<'a>
Sourcepub fn is_plain(&self) -> bool
pub fn is_plain(&self) -> bool
Whether the row has no collapsed inline folds (the identity projection).
Sourcepub fn row_start(&self) -> u32
pub fn row_start(&self) -> u32
Byte offset of the row’s column 0 — for turning a chip’s byte columns back into document offsets (e.g. to test a chip against the selection set).
Sourcepub fn display_cell(&self, col: u32) -> u32
pub fn display_cell(&self, col: u32) -> u32
Byte column → display cell (tab-expanded, inline-collapsed). Total and
monotone; a column hidden inside a chip maps into the chip’s span (use
Self::caret_cell for caret placement, which clips to the center).
Sourcepub fn caret_cell(&self, col: u32) -> CaretCell
pub fn caret_cell(&self, col: u32) -> CaretCell
Caret placement for a byte column: its display cell, or the chip center when the column is hidden inside a collapsed inline fold’s gap.
Whether the glyph at byte column col is hidden inside a collapsed
inline fold (the deliberately-different sibling of the caret rule: the
glyph at open+1 hides while its caret slot stays landable).
Sourcepub fn hit(&self, cell: f32, bias: Bias) -> u32
pub fn hit(&self, cell: f32, bias: Bias) -> u32
Inverse projection: a (fractional, unrounded) display cell → the byte
column a click there lands on. Rounding policy lives HERE, not at call
sites. A cell on a chip resolves to just after the opening bracket;
past-EOL clamps; mid-tab snaps by bias.
Sourcepub fn width(&self) -> u32
pub fn width(&self) -> u32
The row’s rendered display width in cells (tab-expanded, collapsed).
A collapsed block’s inline tail begins FOLD_PLACEHOLDER_CELLS past
this — see HeaderLayout::tail_cell.