Skip to main content

RowLayout

Struct RowLayout 

Source
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>

Source

pub fn is_plain(&self) -> bool

Whether the row has no collapsed inline folds (the identity projection).

Source

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).

Source

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).

Source

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.

Source

pub fn glyph_hidden(&self, col: u32) -> bool

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).

Source

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.

Source

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.

Source

pub fn chips(&self) -> impl Iterator<Item = Chip> + '_

The row’s collapsed chips, in display order.

Auto Trait Implementations§

§

impl<'a> Freeze for RowLayout<'a>

§

impl<'a> RefUnwindSafe for RowLayout<'a>

§

impl<'a> Send for RowLayout<'a>

§

impl<'a> Sync for RowLayout<'a>

§

impl<'a> Unpin for RowLayout<'a>

§

impl<'a> UnsafeUnpin for RowLayout<'a>

§

impl<'a> UnwindSafe for RowLayout<'a>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.