pub(crate) struct ScrollbackBuffer {
pub rows: Vec<Vec<SbCell>>,
pub cur_row: Vec<SbCell>,
pub row_head: usize,
}Expand description
Ring-buffer scrollback store.
rows holds the completed rows (capped at MAX_SCROLLBACK + visible_rows).
cur_row accumulates the line currently being typed.
row_head is the ring-buffer insertion index.
Fields§
§rows: Vec<Vec<SbCell>>Completed rows (ring buffer).
cur_row: Vec<SbCell>Current (partial) row being accumulated.
row_head: usizeRing-buffer head index.
Implementations§
Source§impl ScrollbackBuffer
impl ScrollbackBuffer
Sourcepub fn capacity(&self, visible_rows: usize) -> usize
pub fn capacity(&self, visible_rows: usize) -> usize
Maximum number of rows the buffer can hold before trimming.
Sourcepub fn row_at(&self, logical_idx: usize) -> Option<&Vec<SbCell>>
pub fn row_at(&self, logical_idx: usize) -> Option<&Vec<SbCell>>
Access a completed row by logical (oldest→newest) index.
Sourcepub fn push_row(&mut self, row: Vec<SbCell>, visible_rows: usize)
pub fn push_row(&mut self, row: Vec<SbCell>, visible_rows: usize)
Push a completed row into the ring, growing or wrapping as needed.
Sourcepub fn trim(&mut self, visible_rows: usize)
pub fn trim(&mut self, visible_rows: usize)
Trim the buffer so it does not exceed MAX_SCROLLBACK + visible_rows.
Sourcepub fn mirror_char(
&mut self,
c: char,
cols: usize,
fg: u32,
bg: u32,
visible_rows: usize,
)
pub fn mirror_char( &mut self, c: char, cols: usize, fg: u32, bg: u32, visible_rows: usize, )
Mirror a single character into the current (partial) row, finalising it into the ring when a newline or overflow occurs.
cols = current terminal width in columns.
fg / bg = packed foreground / background colours for the cell.
Auto Trait Implementations§
impl Freeze for ScrollbackBuffer
impl RefUnwindSafe for ScrollbackBuffer
impl Send for ScrollbackBuffer
impl Sync for ScrollbackBuffer
impl Unpin for ScrollbackBuffer
impl UnsafeUnpin for ScrollbackBuffer
impl UnwindSafe for ScrollbackBuffer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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