Raxol.Terminal.Buffer.Manager.Scrollback (Raxol v0.5.0)

View Source

Handles scrollback buffer management for the terminal. Provides functionality for managing scrollback history and operations.

Summary

Functions

Adds a line to the scrollback buffer.

Clears the scrollback buffer.

Checks if the scrollback buffer is full.

Gets the scrollback height limit.

Gets a line from the scrollback buffer.

Gets the number of lines in the scrollback buffer.

Gets a range of lines from the scrollback buffer.

Gets the newest line in the scrollback buffer.

Gets the oldest line in the scrollback buffer.

Sets a new scrollback height limit.

Functions

add_line(state, line)

Adds a line to the scrollback buffer.

Examples

iex> state = State.new(80, 24)
iex> state = Scrollback.add_line(state, "Hello, World!")
iex> Scrollback.get_line(state, 0)
"Hello, World!"

clear(state)

Clears the scrollback buffer.

Examples

iex> state = State.new(80, 24)
iex> state = Scrollback.add_line(state, "Hello, World!")
iex> state = Scrollback.clear(state)
iex> Scrollback.get_line_count(state)
0

full?(state)

Checks if the scrollback buffer is full.

Examples

iex> state = State.new(80, 24)
iex> Scrollback.full?(state)
false

get_height(state)

Gets the scrollback height limit.

Examples

iex> state = State.new(80, 24)
iex> Scrollback.get_height(state)
1000

get_line(state, index)

Gets a line from the scrollback buffer.

Examples

iex> state = State.new(80, 24)
iex> state = Scrollback.add_line(state, "Hello, World!")
iex> Scrollback.get_line(state, 0)
"Hello, World!"

get_line_count(state)

Gets the number of lines in the scrollback buffer.

Examples

iex> state = State.new(80, 24)
iex> state = Scrollback.add_line(state, "Hello, World!")
iex> Scrollback.get_line_count(state)
1

get_lines(state, start, count)

Gets a range of lines from the scrollback buffer.

Examples

iex> state = State.new(80, 24)
iex> state = Scrollback.add_line(state, "Line 1")
iex> state = Scrollback.add_line(state, "Line 2")
iex> Scrollback.get_lines(state, 0, 2)
["Line 1", "Line 2"]

get_newest_line(state)

Gets the newest line in the scrollback buffer.

Examples

iex> state = State.new(80, 24)
iex> state = Scrollback.add_line(state, "Newest line")
iex> Scrollback.get_newest_line(state)
"Newest line"

get_oldest_line(state)

Gets the oldest line in the scrollback buffer.

Examples

iex> state = State.new(80, 24)
iex> state = Scrollback.add_line(state, "Oldest line")
iex> Scrollback.get_oldest_line(state)
"Oldest line"

set_height(state, new_height)

Sets a new scrollback height limit.

Examples

iex> state = State.new(80, 24)
iex> state = Scrollback.set_height(state, 2000)
iex> Scrollback.get_height(state)
2000