pub struct Grid<T> {
    pub cursor: Cursor<T>,
    pub saved_cursor: Cursor<T>,
    /* private fields */
}
Expand description

Grid based terminal content storage.

┌─────────────────────────┐  <-- max_scroll_limit + lines
│                         │
│      UNINITIALIZED      │
│                         │
├─────────────────────────┤  <-- self.raw.inner.len()
│                         │
│      RESIZE BUFFER      │
│                         │
├─────────────────────────┤  <-- self.history_size() + lines
│                         │
│     SCROLLUP REGION     │
│                         │
├─────────────────────────┤v lines
│                         │|
│     VISIBLE  REGION     │|
│                         │|
├─────────────────────────┤^ <-- display_offset
│                         │
│    SCROLLDOWN REGION    │
│                         │
└─────────────────────────┘  <-- zero
                          ^
                       columns

Fields

cursor: Cursor<T>

Current cursor for writing data.

saved_cursor: Cursor<T>

Last saved cursor.

Implementations

Resize the grid’s width and/or height.

Update the size of the scrollback history.

Move lines at the bottom toward the top.

This is the performance-sensitive part of scrolling.

Completely reset the grid state.

Reset a visible region within the grid.

This is used only for initializing after loading ref-tests.

This is used only for truncating before saving ref-tests.

Iterate over all cells in the grid starting at a specific point.

Iterate over all visible cells.

This is slightly more optimized than calling Grid::iter_from in combination with Iterator::take_while.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Total number of lines in the buffer, this includes scrollback and visible lines.

Height of the viewport in lines.

Width of the terminal in columns.

Index for the last column.

Line farthest up in the grid history.

Line farthest down in the grid history.

Number of invisible lines part of the scrollback history.

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.