pub struct LineLayout {
pub len_bytes: usize,
pub width: DisplayColumn,
/* private fields */
}Expand description
A laid-out line: grapheme spans in order.
Fields§
§len_bytes: usizeThe line’s byte length (cursor-at-end needs it).
width: DisplayColumnTotal rendered width in cells.
Implementations§
Source§impl LineLayout
impl LineLayout
Sourcepub fn build(text: &str, tab: usize) -> Self
pub fn build(text: &str, tab: usize) -> Self
Lay out one content line. Tabs expand to stops; control graphemes use the same visible one-cell replacement as the renderer.
Sourcepub fn spans(&self) -> &[GraphemeSpan]
pub fn spans(&self) -> &[GraphemeSpan]
The grapheme spans, in order.
Sourcepub fn cell_at_byte(&self, byte: usize) -> DisplayColumn
pub fn cell_at_byte(&self, byte: usize) -> DisplayColumn
Display cell where a byte offset renders (cursor placement). A byte mid-cluster maps to the cluster’s cell; at/past the end maps to the line’s end cell (vim’s virtual cursor position).
Sourcepub fn byte_at_cell(&self, cell: DisplayColumn) -> usize
pub fn byte_at_cell(&self, cell: DisplayColumn) -> usize
Byte offset of the cluster at a display cell (mouse hit-testing, desired-column). A cell inside a wide cluster maps to its start; past the end maps to the line’s byte length… caller clamps.
Trait Implementations§
Source§impl Clone for LineLayout
impl Clone for LineLayout
Source§fn clone(&self) -> LineLayout
fn clone(&self) -> LineLayout
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LineLayout
impl Debug for LineLayout
Source§impl Default for LineLayout
impl Default for LineLayout
Source§fn default() -> LineLayout
fn default() -> LineLayout
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LineLayout
impl RefUnwindSafe for LineLayout
impl Send for LineLayout
impl Sync for LineLayout
impl Unpin for LineLayout
impl UnsafeUnpin for LineLayout
impl UnwindSafe for LineLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more