Struct cosmic_text::TextBuffer
source · [−]pub struct TextBuffer<'a> {
pub redraw: bool,
/* private fields */
}Expand description
A buffer of text that is shaped and laid out
Fields
redraw: boolImplementations
sourceimpl<'a> TextBuffer<'a>
impl<'a> TextBuffer<'a>
pub fn new(
font_system: &'a FontSystem<'a>,
attrs: Attrs<'a>,
metrics: TextMetrics
) -> Self
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)
pub fn shape_until_cursor(&mut self)
Shape lines until cursor, also scrolling to include cursor in view
pub fn shape_until_scroll(&mut self)
sourcepub fn cursor(&self) -> TextCursor
pub fn cursor(&self) -> TextCursor
Get the current cursor position
sourcepub fn metrics(&self) -> TextMetrics
pub fn metrics(&self) -> TextMetrics
Get the current TextMetrics
sourcepub fn set_metrics(&mut self, metrics: TextMetrics)
pub fn set_metrics(&mut self, metrics: TextMetrics)
Set the current TextMetrics
pub fn attrs(&self) -> &Attrs<'a>
sourcepub fn set_attrs(&mut self, font_system: &'a FontSystem<'a>, attrs: Attrs<'a>)
pub fn set_attrs(&mut self, font_system: &'a FontSystem<'a>, attrs: Attrs<'a>)
Set attributes
sourcepub fn text_lines(&self) -> &[TextBufferLine]
pub fn text_lines(&self) -> &[TextBufferLine]
Get the lines of the original text
sourcepub fn action(&mut self, action: TextAction)
pub fn action(&mut self, action: TextAction)
Perform a TextAction on the buffer
sourcepub fn layout_runs(&self) -> TextLayoutRunIter<'_>ⓘNotable traits for TextLayoutRunIter<'a>impl<'a> Iterator for TextLayoutRunIter<'a> type Item = TextLayoutRun<'a>;
pub fn layout_runs(&self) -> TextLayoutRunIter<'_>ⓘNotable traits for TextLayoutRunIter<'a>impl<'a> Iterator for TextLayoutRunIter<'a> type Item = TextLayoutRun<'a>;
Get the visible layout runs for rendering and other tasks
Auto Trait Implementations
impl<'a> !RefUnwindSafe for TextBuffer<'a>
impl<'a> Send for TextBuffer<'a>
impl<'a> Sync for TextBuffer<'a>
impl<'a> Unpin for TextBuffer<'a>
impl<'a> !UnwindSafe for TextBuffer<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more