Raxol.Terminal.Buffer.Scrollback (Raxol v0.3.0)
View SourceManages the scrollback buffer lines.
Stores lines scrolled off the top and provides them when scrolling down. Enforces a configurable size limit.
Summary
Functions
Adds new lines to the top of the scrollback buffer.
Clears all lines from the scrollback buffer.
Creates a new scrollback buffer with a given limit.
Gets the current number of lines stored in the scrollback buffer.
Takes a number of lines from the top of the scrollback buffer.
Types
@type t() :: %Raxol.Terminal.Buffer.Scrollback{ limit: non_neg_integer(), lines: [Raxol.Terminal.ScreenBuffer.Line.t()] }
Functions
Adds new lines to the top of the scrollback buffer.
Lines are prepended. The buffer is trimmed to the limit if necessary.
Clears all lines from the scrollback buffer.
@spec new(non_neg_integer()) :: t()
Creates a new scrollback buffer with a given limit.
@spec size(t()) :: non_neg_integer()
Gets the current number of lines stored in the scrollback buffer.
@spec take_lines(t(), non_neg_integer()) :: {[Raxol.Terminal.ScreenBuffer.Line.t()], t()}
Takes a number of lines from the top of the scrollback buffer.
Used when scrolling down to restore lines.
Returns a tuple: {restored_lines, updated_scrollback_state}
.
Fewer lines than requested may be returned if the buffer is smaller.