Raxol.Terminal.ScreenBuffer.Selection (Raxol v2.0.1)

View Source

Text selection operations for the screen buffer. Handles selection creation, updates, text extraction, and clipboard operations.

Summary

Functions

Clears the current selection.

Expands selection to word boundaries.

Extends the selection to the specified position.

Gets the selected text as lines.

Gets the selected text as a string.

Gets the current selection boundaries, normalized so start <= end.

Checks if there is an active selection.

Checks if a position is within the current selection.

Selects all content in the buffer.

Selects an entire line.

Selects multiple lines.

Selects a word at the given position.

Checks if the specified position is within the current selection.

Starts a new selection at the specified position.

Types

selection()

@type selection() ::
  {non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()}
  | nil

Functions

clear_selection(buffer)

Clears the current selection.

expand_selection_to_word(buffer)

Expands selection to word boundaries.

extend_selection(buffer, x, y)

Extends the selection to the specified position.

get_selected_lines(buffer)

@spec get_selected_lines(Raxol.Terminal.ScreenBuffer.Core.t()) :: [String.t()]

Gets the selected text as lines.

get_selected_text(buffer)

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

Gets the selected text as a string.

get_selection(buffer)

@spec get_selection(Raxol.Terminal.ScreenBuffer.Core.t()) :: selection()

Gets the current selection boundaries, normalized so start <= end.

has_selection(buffer)

@spec has_selection(Raxol.Terminal.ScreenBuffer.Core.t()) :: boolean()

Checks if there is an active selection.

position_in_selection?(buffer, x, y)

@spec position_in_selection?(
  Raxol.Terminal.ScreenBuffer.Core.t(),
  non_neg_integer(),
  non_neg_integer()
) ::
  boolean()

Checks if a position is within the current selection.

select_all(buffer)

Selects all content in the buffer.

select_line(buffer, y)

Selects an entire line.

select_lines(buffer, start_y, end_y)

Selects multiple lines.

select_word(buffer, x, y)

Selects a word at the given position.

selected?(buffer, x, y)

Checks if the specified position is within the current selection.

start_selection(buffer, x, y)

Starts a new selection at the specified position.