Struct floem_cosmic_text::TextLayout
source · pub struct TextLayout {
pub lines: Vec<TextLayoutLine>,
/* private fields */
}
Expand description
A buffer of text that is shaped and laid out
Fields§
§lines: Vec<TextLayoutLine>
[BufferLine]s (or paragraphs) of text in the buffer
Implementations§
source§impl TextLayout
impl TextLayout
sourcepub fn shape_until(&mut self, lines: i32) -> i32
pub fn shape_until(&mut self, lines: i32) -> i32
Pre-shape lines in the buffer, up to lines
, return actual number of layout lines
sourcepub fn shape_until_cursor(&mut self, cursor: Cursor)
pub fn shape_until_cursor(&mut self, cursor: Cursor)
Shape lines until cursor, also scrolling to include cursor in view
sourcepub fn shape_until_scroll(&mut self)
pub fn shape_until_scroll(&mut self)
Shape lines until scroll
pub fn layout_cursor(&self, cursor: &Cursor) -> LayoutCursor
sourcepub fn line_shape(&mut self, line_i: usize) -> Option<&ShapeLine>
pub fn line_shape(&mut self, line_i: usize) -> Option<&ShapeLine>
Shape the provided line index and return the result
sourcepub fn line_layout(&mut self, line_i: usize) -> Option<&[LayoutLine]>
pub fn line_layout(&mut self, line_i: usize) -> Option<&[LayoutLine]>
Lay out the provided line index and return the result
pub fn size(&self) -> Size
sourcepub fn set_scroll(&mut self, scroll: i32)
pub fn set_scroll(&mut self, scroll: i32)
Set the current scroll location
sourcepub fn set_text(&mut self, text: &str, attrs: AttrsList)
pub fn set_text(&mut self, text: &str, attrs: AttrsList)
Set text of buffer, using provided attributes for each line by default
pub fn set_tab_width(&mut self, tab_width: usize)
sourcepub fn set_redraw(&mut self, redraw: bool)
pub fn set_redraw(&mut self, redraw: bool)
Set redraw needed flag
sourcepub fn layout_runs(&self) -> LayoutRunIter<'_> ⓘ
pub fn layout_runs(&self) -> LayoutRunIter<'_> ⓘ
Get the visible layout runs for rendering and other tasks
pub fn hit_point(&self, point: Point) -> HitPoint
pub fn line_col_position(&self, line: usize, col: usize) -> HitPosition
pub fn hit_position(&self, idx: usize) -> HitPosition
Trait Implementations§
source§impl Clone for TextLayout
impl Clone for TextLayout
source§fn clone(&self) -> TextLayout
fn clone(&self) -> TextLayout
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for TextLayout
impl RefUnwindSafe for TextLayout
impl Send for TextLayout
impl Sync for TextLayout
impl Unpin for TextLayout
impl UnwindSafe for TextLayout
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