Raxol.Terminal.ScreenManager (Raxol v2.0.1)

View Source

Manages screen buffer operations for the terminal emulator. This module handles operations related to the main and alternate screen buffers, including buffer switching, initialization, and state management.

Summary

Functions

Clears the current selection.

Gets the current buffer type (main or alternate).

Gets the currently active screen buffer.

Gets the scroll bottom from the active buffer.

Gets the scroll region from the active buffer.

Gets the scroll top from the active buffer.

Gets the selected text from the buffer.

Gets the current selection from the buffer.

Gets the selection boundaries as {start, end} tuple.

Gets the selection end coordinates.

Gets the selection start coordinates.

Gets the current state of the buffer.

Gets the current style of the buffer.

Gets the style at a specific position.

Gets the style at the cursor position.

Checks if a position is within the current selection.

Initializes both main and alternate screen buffers with default scrollback limit.

Initializes both main and alternate screen buffers.

Parses scrollback limit from options, defaulting to 1000.

Checks if a selection is currently active.

Sets the buffer type.

Sets the scroll region on the buffer.

Starts a selection at the specified position.

Switches between main and alternate screen buffers.

Updates the currently active screen buffer.

Updates the selection end position.

Writes a string to the buffer at the given position with the given style.

Functions

clear_selection(buffer)

Clears the current selection.

get_buffer_type(emulator)

@spec get_buffer_type(Raxol.Terminal.Emulator.Struct.t()) :: :main | :alternate

Gets the current buffer type (main or alternate).

get_screen_buffer(emulator)

Gets the currently active screen buffer.

get_scroll_bottom(buffer)

@spec get_scroll_bottom(Raxol.Terminal.ScreenBuffer.t()) :: non_neg_integer()

Gets the scroll bottom from the active buffer.

get_scroll_region(buffer)

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

Gets the scroll region from the active buffer.

get_scroll_top(buffer)

@spec get_scroll_top(Raxol.Terminal.ScreenBuffer.t()) :: non_neg_integer()

Gets the scroll top from the active buffer.

get_selected_text(buffer)

@spec get_selected_text(Raxol.Terminal.ScreenBuffer.t()) :: String.t()

Gets the selected text from the buffer.

get_selection(buffer)

@spec get_selection(Raxol.Terminal.ScreenBuffer.t()) :: String.t()

Gets the current selection from the buffer.

get_selection_boundaries(buffer)

@spec get_selection_boundaries(Raxol.Terminal.ScreenBuffer.t()) ::
  {{non_neg_integer(), non_neg_integer()},
   {non_neg_integer(), non_neg_integer()}}
  | nil

Gets the selection boundaries as {start, end} tuple.

get_selection_end(buffer)

@spec get_selection_end(Raxol.Terminal.ScreenBuffer.t()) ::
  {non_neg_integer(), non_neg_integer()} | nil

Gets the selection end coordinates.

get_selection_start(buffer)

@spec get_selection_start(Raxol.Terminal.ScreenBuffer.t()) ::
  {non_neg_integer(), non_neg_integer()} | nil

Gets the selection start coordinates.

get_state(buffer)

@spec get_state(Raxol.Terminal.ScreenBuffer.t()) :: map()

Gets the current state of the buffer.

get_style(buffer)

@spec get_style(Raxol.Terminal.ScreenBuffer.t()) :: map()

Gets the current style of the buffer.

get_style_at(buffer, x, y)

Gets the style at a specific position.

get_style_at_cursor(buffer)

@spec get_style_at_cursor(Raxol.Terminal.ScreenBuffer.t()) :: map()

Gets the style at the cursor position.

in_selection?(buffer, x, y)

Checks if a position is within the current selection.

initialize_buffers(width, height)

Initializes both main and alternate screen buffers with default scrollback limit.

initialize_buffers(width, height, scrollback_limit)

Initializes both main and alternate screen buffers.

parse_scrollback_limit(opts)

@spec parse_scrollback_limit(keyword()) :: non_neg_integer()

Parses scrollback limit from options, defaulting to 1000.

resize_buffers(emulator, new_width, new_height)

Resizes both screen buffers.

selection_active?(buffer)

@spec selection_active?(Raxol.Terminal.ScreenBuffer.t()) :: boolean()

Checks if a selection is currently active.

set_buffer_type(emulator, type)

@spec set_buffer_type(Raxol.Terminal.Emulator.Struct.t(), :main | :alternate) ::
  Raxol.Terminal.Emulator.Struct.t()

Sets the buffer type.

set_scroll_region(buffer, arg)

Sets the scroll region on the buffer.

start_selection(buffer, x, y)

Starts a selection at the specified position.

switch_buffer(emulator)

Switches between main and alternate screen buffers.

update_active_buffer(emulator, new_buffer)

Updates the currently active screen buffer.

update_selection(buffer, x, y)

Updates the selection end position.

write_string(buffer, x, y, string, style)

Writes a string to the buffer at the given position with the given style.