Raxol.Terminal.Commands.CSIHandler.CursorMovementHandler (Raxol v2.0.1)

View Source

Handles cursor movement operations for CSI sequences.

Provides full implementation of cursor movement commands integrating with the existing Raxol.Terminal.Cursor module for consistent cursor state management.

Supports all standard VT100/ANSI cursor movement sequences:

  • Cursor Up (CUU)
  • Cursor Down (CUD)
  • Cursor Forward/Right (CUF)
  • Cursor Backward/Left (CUB)
  • Cursor Position (CUP)
  • Horizontal and Vertical Position Absolute (HPA/VPA)

Summary

Functions

Checks if cursor is at the edge of the screen.

Gets the current cursor position.

Moves cursor backward (left) by specified amount. CUB - Cursor Backward

Sets cursor to specific column (Horizontal Position Absolute). HPA - Horizontal Position Absolute

Moves cursor down by specified amount. CUD - Cursor Down

Moves cursor forward (right) by specified amount. CUF - Cursor Forward

Sets cursor position from parameter list. CUP - Cursor Position

Sets cursor position directly with row and column. CUP - Cursor Position (Direct)

Sets cursor position directly without parameter validation. Used internally for absolute positioning.

Sets cursor to specific row (Vertical Position Absolute). VPA - Vertical Position Absolute

Moves cursor up by specified amount. CUU - Cursor Up

Types

cursor_amount()

@type cursor_amount() :: non_neg_integer()

cursor_position()

@type cursor_position() :: {non_neg_integer(), non_neg_integer()}

emulator()

@type emulator() :: Raxol.Terminal.Emulator.t()

Functions

cursor_at_edge?(emulator)

@spec cursor_at_edge?(emulator()) :: %{
  top: boolean(),
  bottom: boolean(),
  left: boolean(),
  right: boolean()
}

Checks if cursor is at the edge of the screen.

get_cursor_position(emulator)

@spec get_cursor_position(emulator()) :: cursor_position()

Gets the current cursor position.

handle_cursor_backward(emulator, amount)

@spec handle_cursor_backward(emulator(), cursor_amount()) :: {:ok, emulator()}

Moves cursor backward (left) by specified amount. CUB - Cursor Backward

handle_cursor_column(emulator, column)

@spec handle_cursor_column(emulator(), non_neg_integer()) :: {:ok, emulator()}

Sets cursor to specific column (Horizontal Position Absolute). HPA - Horizontal Position Absolute

handle_cursor_down(emulator, amount)

@spec handle_cursor_down(emulator(), cursor_amount()) :: {:ok, emulator()}

Moves cursor down by specified amount. CUD - Cursor Down

handle_cursor_forward(emulator, amount)

@spec handle_cursor_forward(emulator(), cursor_amount()) :: {:ok, emulator()}

Moves cursor forward (right) by specified amount. CUF - Cursor Forward

handle_cursor_position(emulator, params)

@spec handle_cursor_position(emulator(), [non_neg_integer()]) :: {:ok, emulator()}

Sets cursor position from parameter list. CUP - Cursor Position

handle_cursor_position(emulator, row, col)

@spec handle_cursor_position(emulator(), non_neg_integer(), non_neg_integer()) ::
  {:ok, emulator()}

Sets cursor position directly with row and column. CUP - Cursor Position (Direct)

handle_cursor_position_direct(emulator, row, col)

@spec handle_cursor_position_direct(
  emulator(),
  non_neg_integer(),
  non_neg_integer()
) :: {:ok, emulator()}

Sets cursor position directly without parameter validation. Used internally for absolute positioning.

handle_cursor_row(emulator, row)

@spec handle_cursor_row(emulator(), non_neg_integer()) :: {:ok, emulator()}

Sets cursor to specific row (Vertical Position Absolute). VPA - Vertical Position Absolute

handle_cursor_up(emulator, amount)

@spec handle_cursor_up(emulator(), cursor_amount()) :: {:ok, emulator()}

Moves cursor up by specified amount. CUU - Cursor Up