pub struct Grid<T> {
pub selection: Option<Selection>,
/* private fields */
}
Expand description
Represents the terminal display contents
┌─────────────────────────┐ <-- 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
^
cols
Fields§
§selection: Option<Selection>
Selected region.
Implementations§
Source§impl<T: GridCell + PartialEq + Copy> Grid<T>
impl<T: GridCell + PartialEq + Copy> Grid<T>
pub fn new(lines: Line, cols: Column, scrollback: usize, template: T) -> Grid<T>
pub fn buffer_to_visible( &self, point: impl Into<Point<usize>>, ) -> Option<Point<usize>>
pub fn visible_to_buffer(&self, point: Point) -> Point<usize>
Sourcepub fn update_history(&mut self, history_size: usize)
pub fn update_history(&mut self, history_size: usize)
Update the size of the scrollback history
pub fn scroll_display(&mut self, scroll: Scroll)
pub fn resize( &mut self, reflow: bool, lines: Line, cols: Column, cursor_pos: &mut Point, template: &T, )
Sourcepub fn line_to_offset(&self, line: Line) -> usize
pub fn line_to_offset(&self, line: Line) -> usize
Convert a Line index (active region) to a buffer offset
§Panics
This method will panic if Line
is larger than the grid dimensions
pub fn scroll_down( &mut self, region: &Range<Line>, positions: Line, template: &T, )
Sourcepub fn scroll_up(&mut self, region: &Range<Line>, positions: Line, template: &T)
pub fn scroll_up(&mut self, region: &Range<Line>, positions: Line, template: &T)
scroll_up moves lines at the bottom towards the top
This is the performance-sensitive part of scrolling.
pub fn clear_viewport(&mut self, template: &T)
pub fn reset(&mut self, template: &T)
Source§impl<T> Grid<T>
impl<T> Grid<T>
pub fn num_lines(&self) -> Line
pub fn display_iter(&self) -> DisplayIter<'_, T> ⓘ
pub fn num_cols(&self) -> Column
pub fn clear_history(&mut self)
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Total number of lines in the buffer, this includes scrollback + visible lines
pub fn history_size(&self) -> usize
Sourcepub fn initialize_all(&mut self, template: &T)
pub fn initialize_all(&mut self, template: &T)
This is used only for initializing after loading ref-tests
pub fn iter_from(&self, point: Point<usize>) -> GridIterator<'_, T> ⓘ
pub fn contains(&self, point: &Point) -> bool
pub fn display_offset(&self) -> usize
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Grid<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Grid<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> IndexRegion<RangeFull, T> for Grid<T>
impl<T> IndexRegion<RangeFull, T> for Grid<T>
Auto Trait Implementations§
impl<T> Freeze for Grid<T>
impl<T> RefUnwindSafe for Grid<T>where
T: RefUnwindSafe,
impl<T> Send for Grid<T>where
T: Send,
impl<T> Sync for Grid<T>where
T: Sync,
impl<T> Unpin for Grid<T>where
T: Unpin,
impl<T> UnwindSafe for Grid<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)