Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ impl Grid {
self.size
}

pub fn row_count(&self) -> usize {
self.rows.len()
}

pub fn set_size(&mut self, size: Size) {
if size.cols != self.size.cols {
for row in &mut self.rows {
Expand Down Expand Up @@ -122,7 +126,7 @@ impl Grid {
self.scrollback
.iter()
.skip(scrollback_len - self.scrollback_offset)
.chain(self.rows.iter().take(rows_len - self.scrollback_offset))
.chain(self.rows.iter().take(rows_len.saturating_sub(self.scrollback_offset)))
}

pub fn drawing_rows(&self) -> impl Iterator<Item = &crate::row::Row> {
Expand Down
4 changes: 4 additions & 0 deletions src/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ impl Screen {
.set_size(crate::grid::Size { rows, cols });
}

pub fn scrollback_rows(&self) -> usize {
self.grid.row_count()
}

/// Returns the current size of the terminal.
///
/// The return value will be (rows, cols).
Expand Down