Raxol.Terminal.Buffer.Selection (Raxol v0.2.0)
View SourceHandles text selection within the Raxol.Terminal.ScreenBuffer.
Summary
Functions
Checks if a position (x, y) is within the current selection in the buffer.
Gets the boundaries {start_x, start_y, end_x, end_y} of the current selection. Returns nil if there is no selection.
Gets the text within the current selection in the buffer.
Gets the text within a specified rectangular region of the buffer. Coordinates are inclusive.
Starts a selection at the specified coordinates in the buffer.
Updates the endpoint of the current selection in the buffer.
Functions
@spec contains?(Raxol.Terminal.ScreenBuffer.t(), non_neg_integer(), non_neg_integer()) :: boolean()
Checks if a position (x, y) is within the current selection in the buffer.
@spec get_boundaries(Raxol.Terminal.ScreenBuffer.t()) :: {non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()} | nil
Gets the boundaries {start_x, start_y, end_x, end_y} of the current selection. Returns nil if there is no selection.
@spec get_text(Raxol.Terminal.ScreenBuffer.t()) :: String.t()
Gets the text within the current selection in the buffer.
@spec get_text_in_region( Raxol.Terminal.ScreenBuffer.t(), non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer() ) :: String.t()
Gets the text within a specified rectangular region of the buffer. Coordinates are inclusive.
@spec start(Raxol.Terminal.ScreenBuffer.t(), non_neg_integer(), non_neg_integer()) :: Raxol.Terminal.ScreenBuffer.t()
Starts a selection at the specified coordinates in the buffer.
@spec update(Raxol.Terminal.ScreenBuffer.t(), non_neg_integer(), non_neg_integer()) :: Raxol.Terminal.ScreenBuffer.t()
Updates the endpoint of the current selection in the buffer.