Raxol.Terminal.Commands.CursorHandler (Raxol v2.0.1)

View Source

Handles cursor movement related CSI commands.

This module contains handlers for cursor movement commands like CUP, CUU, CUD, etc. Each function takes the current emulator state and parsed parameters, returning the updated emulator state.

Summary

Functions

Handles CSI A - Cursor Up (CUU)

Handles Cursor Up (CUU - 'A')

Handles CSI B - Cursor Down (CUD)

Handles Cursor Down (CUD - 'B') - alias for handle_B

Handles CSI C - Cursor Forward (CUF)

Handles Cursor Forward (CUF - 'C') - alias for handle_C

Handles Cursor Position (CUP - 'H")

Handles CSI D - Cursor Back (CUB)

Handles Cursor Vertical Absolute (VPA - 'd') - alias for handle_decvpa

Handles Cursor Backward (CUB - 'D') - alias for handle_D

Handles Cursor Vertical Absolute (VPA - 'd")

Handles CSI E - Cursor Next Line (CNL) Moves cursor to beginning of line n lines down

Handles Cursor Next Line (CNL - 'E').

Handles CSI F - Cursor Previous Line (CPL) Moves cursor to beginning of line n lines up

Handles Cursor Previous Line (CPL - 'F').

Handles Cursor Previous Line (CPL - 'F') - alias for handle_f.

Handles CSI G - Cursor Horizontal Absolute (CHA)

Handles Cursor Horizontal Absolute (CHA - 'G').

Handles Cursor Horizontal Absolute (CHA - 'G') - alias for handle_g.

Handles CSI H - Cursor Position (CUP) Sets cursor position to row;column

Handles Cursor Position (CUP - 'H') - alias for handle_cup

Moves the cursor back by the specified number of columns.

Moves the cursor down by the specified number of lines.

Moves the cursor down by the specified number of lines with width and height bounds.

Moves the cursor forward by the specified number of columns.

Moves the cursor left by the specified number of columns.

Moves the cursor right by the specified number of columns.

Moves the cursor to a specific position.

Moves the cursor to a specific position with width and height bounds.

Moves the cursor to a specific column.

Moves the cursor to the start of the current line.

Moves the cursor up by the specified number of lines.

Moves the cursor up by the specified number of lines with width and height bounds.

Functions

handle_A(emulator, params)

Handles CSI A - Cursor Up (CUU)

handle_a_alias(emulator, params)

@spec handle_a_alias(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Up (CUU - 'A')

handle_B(emulator, params)

Handles CSI B - Cursor Down (CUD)

handle_b_alias(emulator, params)

@spec handle_b_alias(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Down (CUD - 'B') - alias for handle_B

handle_C(emulator, params)

Handles CSI C - Cursor Forward (CUF)

handle_c_alias(emulator, params)

@spec handle_c_alias(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Forward (CUF - 'C') - alias for handle_C

handle_cup(emulator, params)

@spec handle_cup(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Position (CUP - 'H")

handle_cursor_movement(emulator, direction, amount)

@spec handle_cursor_movement(
  Raxol.Terminal.Emulator.t(),
  atom(),
  integer()
) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

handle_D(emulator, params)

Handles CSI D - Cursor Back (CUB)

handle_d(emulator, params)

@spec handle_d(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Vertical Absolute (VPA - 'd') - alias for handle_decvpa

handle_d_alias(emulator, params)

@spec handle_d_alias(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Backward (CUB - 'D') - alias for handle_D

handle_decvpa(emulator, params)

@spec handle_decvpa(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Vertical Absolute (VPA - 'd")

handle_E(emulator, params)

Handles CSI E - Cursor Next Line (CNL) Moves cursor to beginning of line n lines down

handle_e_alias(emulator, params)

@spec handle_e_alias(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Next Line (CNL - 'E').

handle_F(emulator, params)

Handles CSI F - Cursor Previous Line (CPL) Moves cursor to beginning of line n lines up

handle_f(emulator, params)

@spec handle_f(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Previous Line (CPL - 'F').

handle_f_alias(emulator, params)

@spec handle_f_alias(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Previous Line (CPL - 'F') - alias for handle_f.

handle_G(emulator, params)

Handles CSI G - Cursor Horizontal Absolute (CHA)

handle_g(emulator, params)

@spec handle_g(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Horizontal Absolute (CHA - 'G').

handle_g_alias(emulator, params)

@spec handle_g_alias(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Horizontal Absolute (CHA - 'G') - alias for handle_g.

handle_H(emulator, params)

Handles CSI H - Cursor Position (CUP) Sets cursor position to row;column

handle_h_alias(emulator, params)

@spec handle_h_alias(Raxol.Terminal.Emulator.t(), [integer()]) ::
  {:ok, Raxol.Terminal.Emulator.t()}
  | {:error, atom(), Raxol.Terminal.Emulator.t()}

Handles Cursor Position (CUP - 'H') - alias for handle_cup

move_cursor_back(emulator, count)

Moves the cursor back by the specified number of columns.

move_cursor_down(emulator, count \\ 1)

Moves the cursor down by the specified number of lines.

move_cursor_down(emulator, count, width, height)

Moves the cursor down by the specified number of lines with width and height bounds.

move_cursor_forward(emulator, count)

Moves the cursor forward by the specified number of columns.

move_cursor_left(emulator, count, width, height)

Moves the cursor left by the specified number of columns.

move_cursor_right(emulator, count, width, height)

Moves the cursor right by the specified number of columns.

move_cursor_to(emulator, x, y)

Moves the cursor to a specific position.

move_cursor_to(emulator, position, width, height)

@spec move_cursor_to(
  Raxol.Terminal.Emulator.t(),
  {integer(), integer()},
  integer(),
  integer()
) :: Raxol.Terminal.Emulator.t()

Moves the cursor to a specific position with width and height bounds.

move_cursor_to_column(emulator, column, width, height)

Moves the cursor to a specific column.

move_cursor_to_line_start(emulator)

@spec move_cursor_to_line_start(Raxol.Terminal.Emulator.t()) ::
  Raxol.Terminal.Emulator.t()

Moves the cursor to the start of the current line.

move_cursor_up(emulator, count \\ 1)

Moves the cursor up by the specified number of lines.

move_cursor_up(emulator, count, width, height)

Moves the cursor up by the specified number of lines with width and height bounds.