Raxol.Terminal.Buffer.Scroller (Raxol v0.5.0)

View Source

Handles scrolling operations for the terminal buffer.

Summary

Functions

Gets the scroll bottom position.

Gets the scroll top position.

Scrolls the buffer down by the specified number of lines.

Scrolls the entire buffer down by the specified number of lines.

Scrolls the entire buffer up by the specified number of lines.

Scrolls a specific region of the buffer down by the specified number of lines.

Scrolls a specific region of the buffer up by the specified number of lines.

Scrolls the buffer up by the specified number of lines.

Functions

get_scroll_bottom(buffer, scroll_margins)

Gets the scroll bottom position.

get_scroll_top(buffer, scroll_margins)

Gets the scroll top position.

scroll_down(buffer, count)

Scrolls the buffer down by the specified number of lines.

scroll_entire_buffer_down(buffer, count)

@spec scroll_entire_buffer_down(Raxol.Terminal.ScreenBuffer.t(), non_neg_integer()) ::
  {:ok, Raxol.Terminal.ScreenBuffer.t()}

Scrolls the entire buffer down by the specified number of lines.

Parameters

  • buffer - The screen buffer to scroll
  • count - The number of lines to scroll down

Returns

A tuple containing :ok and the updated buffer.

Examples

iex> buffer = ScreenBuffer.new(80, 24)
iex> {:ok, new_buffer} = Scroller.scroll_entire_buffer_down(buffer, 1)
iex> length(new_buffer.content)
24

scroll_entire_buffer_up(buffer, count)

@spec scroll_entire_buffer_up(Raxol.Terminal.ScreenBuffer.t(), non_neg_integer()) ::
  {:ok, Raxol.Terminal.ScreenBuffer.t()}

Scrolls the entire buffer up by the specified number of lines.

Parameters

  • buffer - The screen buffer to scroll
  • count - The number of lines to scroll up

Returns

A tuple containing :ok and the updated buffer.

Examples

iex> buffer = ScreenBuffer.new(80, 24)
iex> {:ok, new_buffer} = Scroller.scroll_entire_buffer_up(buffer, 1)
iex> length(new_buffer.content)
24

scroll_region_down(buffer, count, top, bottom)

Scrolls a specific region of the buffer down by the specified number of lines.

Parameters

  • buffer - The screen buffer to scroll
  • count - The number of lines to scroll down
  • top - The top boundary of the scroll region
  • bottom - The bottom boundary of the scroll region

Returns

A tuple containing :ok and the updated buffer.

Examples

iex> buffer = ScreenBuffer.new(80, 24)
iex> {:ok, new_buffer} = Scroller.scroll_region_down(buffer, 1, 5, 15)
iex> length(new_buffer.content)
24

scroll_region_up(buffer, count, top, bottom)

Scrolls a specific region of the buffer up by the specified number of lines.

Parameters

  • buffer - The screen buffer to scroll
  • count - The number of lines to scroll up
  • top - The top boundary of the scroll region
  • bottom - The bottom boundary of the scroll region

Returns

A tuple containing :ok and the updated buffer.

Examples

iex> buffer = ScreenBuffer.new(80, 24)
iex> {:ok, new_buffer} = Scroller.scroll_region_up(buffer, 1, 5, 15)
iex> length(new_buffer.content)
24

scroll_up(buffer, count)

Scrolls the buffer up by the specified number of lines.