pub struct Grid { /* private fields */ }Expand description
Terminal grid with scrollback buffer
Uses VecDeque to efficiently manage scrollback history. The visible rows are at the end of the deque, with scrollback history at the front.
Implementations§
Source§impl Grid
impl Grid
Sourcepub fn restore_pos(&mut self)
pub fn restore_pos(&mut self)
Restore cursor position
Sourcepub fn scrollback(&self) -> usize
pub fn scrollback(&self) -> usize
Get current scrollback offset
Sourcepub fn set_scrollback(&mut self, offset: usize)
pub fn set_scrollback(&mut self, offset: usize)
Set scrollback offset
Sourcepub fn scrollback_available(&self) -> usize
pub fn scrollback_available(&self) -> usize
Get available scrollback lines
Sourcepub fn set_scroll_region(&mut self, top: u16, bottom: u16)
pub fn set_scroll_region(&mut self, top: u16, bottom: u16)
Set scroll region
Sourcepub fn reset_scroll_region(&mut self)
pub fn reset_scroll_region(&mut self)
Reset scroll region to full screen
Sourcepub fn visible_row(&self, row: u16) -> Option<&Row>
pub fn visible_row(&self, row: u16) -> Option<&Row>
Get a visible row (accounting for scrollback offset)
Sourcepub fn drawing_row(&self, row: u16) -> Option<&Row>
pub fn drawing_row(&self, row: u16) -> Option<&Row>
Get a drawing row (for writing, ignores scrollback offset)
Sourcepub fn drawing_row_mut(&mut self, row: u16) -> Option<&mut Row>
pub fn drawing_row_mut(&mut self, row: u16) -> Option<&mut Row>
Get a mutable drawing row
Sourcepub fn current_row(&self) -> Option<&Row>
pub fn current_row(&self) -> Option<&Row>
Get current row (at cursor position)
Sourcepub fn current_row_mut(&mut self) -> Option<&mut Row>
pub fn current_row_mut(&mut self) -> Option<&mut Row>
Get mutable current row
Sourcepub fn scroll_down(&mut self, count: usize)
pub fn scroll_down(&mut self, count: usize)
Scroll down within scroll region
Sourcepub fn clear_below(&mut self)
pub fn clear_below(&mut self)
Clear from cursor to end of screen
Sourcepub fn clear_above(&mut self)
pub fn clear_above(&mut self)
Clear from start of screen to cursor
Sourcepub fn get_selected_text(
&self,
low_x: i32,
low_y: i32,
high_x: i32,
high_y: i32,
) -> String
pub fn get_selected_text( &self, low_x: i32, low_y: i32, high_x: i32, high_y: i32, ) -> String
Get selected text from coordinates
Handles wrapped lines correctly (no newline for soft-wrapped rows)
Sourcepub fn visible_rows(&self) -> impl Iterator<Item = &Row>
pub fn visible_rows(&self) -> impl Iterator<Item = &Row>
Iterate over visible rows
Sourcepub fn drawing_rows(&self) -> impl Iterator<Item = &Row>
pub fn drawing_rows(&self) -> impl Iterator<Item = &Row>
Iterate over drawing rows (ignoring scrollback offset)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Grid
impl RefUnwindSafe for Grid
impl Send for Grid
impl Sync for Grid
impl Unpin for Grid
impl UnwindSafe for Grid
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more