ttx 0.1.0
|
Represents the terminal scroll back. More...
#include <ttx/terminal/scroll_back.h>
Public Member Functions | |
auto | absolute_row_start () const -> u64 |
auto | absolute_row_end () const -> u64 |
auto | total_rows () const -> usize |
void | clear () |
Clear the scroll back history. | |
void | add_rows (RowGroup &from, usize row_index, usize row_count) |
Add rows to the scroll back buffer. | |
void | take_rows (RowGroup &to, u32 desired_cols, usize row_index, usize row_count) |
Remove rows from the scroll back buffer. | |
auto | find_row (u64 row) const -> di::Tuple< u32, RowGroup const & > |
Represents the terminal scroll back.
The scroll back is effectively immutable and optimized to minimize the memory needed per cell. Blank cells are not stored but still accessible when iterating over a row.
The scroll back is unaffected by resize operations (until rewrap is supported), so rows can be over or under sized depending on the actual screen size when the scroll back is being rendered.
For efficiency, the scroll back is divided into chunks which target a particular number of cells, and represent a collection of visual terminal lines. The memory limit for the scroll back buffer is specified by the total number of cells allowed, which is used to determine the number of chunks.
|
inline |
|
inline |
void ttx::terminal::ScrollBack::add_rows | ( | RowGroup & | from, |
usize | row_index, | ||
usize | row_count ) |
void ttx::terminal::ScrollBack::clear | ( | ) |
Clear the scroll back history.
auto ttx::terminal::ScrollBack::find_row | ( | u64 | row | ) | const -> di::Tuple<u32, RowGroup const&> |
void ttx::terminal::ScrollBack::take_rows | ( | RowGroup & | to, |
u32 | desired_cols, | ||
usize | row_index, | ||
usize | row_count ) |
Remove rows from the scroll back buffer.
from | Row group to tranfer to |
desired_cols | Number of columns to force in the output |
row_index | Row index within the group to insert |
row_count | Number of rows to take |
This function requires: row_count >= total rows in scroll back.
The desired_cols value ensures that the inserted rows will have the correct number of cells per row. The row from scrollback will either be truncated or padded with empty cells to meet this constraint.
|
inline |