Raxol.UI.Components.Input.MultiLineInput.NavigationHelper (Raxol v2.0.1)

View Source

Navigation helper functions for MultiLineInput component cursor movement and selection operations.

Summary

Functions

Clears the current selection.

Checks if a line index is within the selection range.

Moves the cursor in the specified direction within the multi-line input.

Moves the cursor to the end of the document.

Moves the cursor to the start of the document.

Moves the cursor to the end of the current line.

Moves the cursor to the start of the current line.

Moves the cursor by a page (viewport height) in the specified direction.

Normalizes the selection range, ensuring start comes before end. Returns {nil, nil} if no selection exists.

Selects all text in the input.

Functions

clear_selection(state)

Clears the current selection.

line_in_selection?(line_index, start_pos, end_pos)

@spec line_in_selection?(
  integer(),
  {integer(), integer()} | nil,
  {integer(), integer()} | nil
) :: boolean()

Checks if a line index is within the selection range.

move_cursor(state, direction)

@spec move_cursor(
  Raxol.UI.Components.Input.MultiLineInput.t(),
  :left | :right | :up | :down
) ::
  Raxol.UI.Components.Input.MultiLineInput.t()

Moves the cursor in the specified direction within the multi-line input.

move_cursor_doc_end(state)

Moves the cursor to the end of the document.

move_cursor_doc_start(state)

Moves the cursor to the start of the document.

move_cursor_line_end(state)

Moves the cursor to the end of the current line.

move_cursor_line_start(state)

Moves the cursor to the start of the current line.

move_cursor_page(state, direction)

Moves the cursor by a page (viewport height) in the specified direction.

normalize_selection(state)

@spec normalize_selection(Raxol.UI.Components.Input.MultiLineInput.t()) ::
  {{integer(), integer()}, {integer(), integer()}} | {nil, nil}

Normalizes the selection range, ensuring start comes before end. Returns {nil, nil} if no selection exists.

select_all(state)

Selects all text in the input.