Raxol.Terminal.ScreenBuffer.Selection
(Raxol v2.3.0)
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. Starts a new selection if none exists.
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.
Delegates to selected?/3.
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.
Delegates to has_selection?/1.
Starts a new selection at the specified position.
Updates the selection endpoint. Returns buffer unchanged if no selection exists.
Unlike extend_selection/3, does not start a new selection on nil.
Types
@type selection() :: {non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()} | nil
Functions
@spec clear_selection(Raxol.Terminal.ScreenBuffer.Core.t()) :: Raxol.Terminal.ScreenBuffer.Core.t()
Clears the current selection.
@spec expand_selection_to_word(Raxol.Terminal.ScreenBuffer.Core.t()) :: Raxol.Terminal.ScreenBuffer.Core.t()
Expands selection to word boundaries.
@spec extend_selection( Raxol.Terminal.ScreenBuffer.Core.t(), non_neg_integer(), non_neg_integer() ) :: Raxol.Terminal.ScreenBuffer.Core.t()
Extends the selection to the specified position. Starts a new selection if none exists.
@spec get_selected_lines(Raxol.Terminal.ScreenBuffer.Core.t()) :: [String.t()]
Gets the selected text as lines.
@spec get_selected_text(Raxol.Terminal.ScreenBuffer.Core.t()) :: String.t()
Gets the selected text as a string.
@spec get_selection(Raxol.Terminal.ScreenBuffer.Core.t()) :: selection()
Gets the current selection boundaries, normalized so start <= end.
@spec get_selection_boundaries(Raxol.Terminal.ScreenBuffer.Core.t()) :: {{non_neg_integer(), non_neg_integer()}, {non_neg_integer(), non_neg_integer()}} | nil
@spec get_selection_end(Raxol.Terminal.ScreenBuffer.Core.t()) :: {non_neg_integer(), non_neg_integer()} | nil
@spec get_selection_start(Raxol.Terminal.ScreenBuffer.Core.t()) :: {non_neg_integer(), non_neg_integer()} | nil
@spec has_selection?(Raxol.Terminal.ScreenBuffer.Core.t()) :: boolean()
Checks if there is an active selection.
@spec position_in_selection?( Raxol.Terminal.ScreenBuffer.Core.t(), integer(), integer() ) :: boolean()
Checks if a position is within the current selection.
Delegates to selected?/3.
@spec select_all(Raxol.Terminal.ScreenBuffer.Core.t()) :: Raxol.Terminal.ScreenBuffer.Core.t()
Selects all content in the buffer.
@spec select_line(Raxol.Terminal.ScreenBuffer.Core.t(), integer()) :: Raxol.Terminal.ScreenBuffer.Core.t()
Selects an entire line.
@spec select_lines(Raxol.Terminal.ScreenBuffer.Core.t(), integer(), integer()) :: Raxol.Terminal.ScreenBuffer.Core.t()
Selects multiple lines.
@spec select_word(Raxol.Terminal.ScreenBuffer.Core.t(), integer(), integer()) :: Raxol.Terminal.ScreenBuffer.Core.t()
Selects a word at the given position.
@spec selected?(Raxol.Terminal.ScreenBuffer.Core.t(), integer(), integer()) :: boolean()
Checks if the specified position is within the current selection.
@spec selection_active?(Raxol.Terminal.ScreenBuffer.Core.t()) :: boolean()
Delegates to has_selection?/1.
@spec start_selection( Raxol.Terminal.ScreenBuffer.Core.t(), non_neg_integer(), non_neg_integer() ) :: Raxol.Terminal.ScreenBuffer.Core.t()
Starts a new selection at the specified position.
@spec update_selection( Raxol.Terminal.ScreenBuffer.Core.t(), non_neg_integer(), non_neg_integer() ) :: Raxol.Terminal.ScreenBuffer.Core.t()
Updates the selection endpoint. Returns buffer unchanged if no selection exists.
Unlike extend_selection/3, does not start a new selection on nil.