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

View Source

Manages text selection operations for the terminal. This module handles all selection-related operations including:

  • Starting and updating selections
  • Getting selected text
  • Checking if positions are within selections
  • Managing selection boundaries
  • Extracting text from regions

Summary

Functions

Checks if there is an active selection.

Clears the current selection.

Checks if a position is within the current selection.

Gets the current selection boundaries.

Gets the selection end position.

Gets the selection start position.

Gets the currently selected text.

Gets text from a specified region in the buffer.

Starts a text selection at the specified position.

Updates the current text selection to the specified position.

Functions

active?(buffer)

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

Checks if there is an active selection.

clear(buffer)

Clears the current selection.

contains?(buffer, x, y)

Checks if a position is within the current selection.

get_boundaries(buffer)

Gets the current selection boundaries.

get_end_position(buffer)

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

Gets the selection end position.

get_start_position(buffer)

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

Gets the selection start position.

get_text(buffer)

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

Gets the currently selected text.

get_text_in_region(buffer, start_x, start_y, end_x, end_y)

Gets text from a specified region in the buffer.

start(buffer, x, y)

Starts a text selection at the specified position.

update(buffer, x, y)

Updates the current text selection to the specified position.