pub struct TextBuffer<'a> {
    pub lines: Vec<TextBufferLine<'a>>,
    pub cursor_moved: bool,
    pub redraw: bool,
    /* private fields */
}
Expand description

A buffer of text that is shaped and laid out

Fields

lines: Vec<TextBufferLine<'a>>

Lines (or paragraphs) of text in the buffer

cursor_moved: bool

True if the cursor has been moved. Set to false after processing

Usually, if this is true, you should run Self::shape_until_cursor before redrawing. Otherwise, you should run Self::shape_until_scroll

redraw: bool

True if a redraw is requires. Set to false after processing

Implementations

Pre-shape lines in the buffer, up to lines, return actual number of layout lines

Shape lines until cursor, also scrolling to include cursor in view

Shape lines until scroll

Get the current cursor position

Get the current TextMetrics

Set the current TextMetrics

Get the current buffer dimensions (width, height)

Set the current buffer dimensions

Get the current scroll location

Get the number of lines that can be viewed in the buffer

Set text of buffer, using provided attributes for each line by default

Perform a TextAction on the buffer

Convert x, y position to TextCursor (hit detection)

Get the visible layout runs for rendering and other tasks

Draw the buffer

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.