Raxol.Terminal.Emulator.Cursor (Raxol v0.3.0)

View Source

Handles cursor management for the terminal emulator. Provides functions for cursor position, style, movement, and state management.

Summary

Functions

Hides the cursor. Returns {:ok, updated_emulator}.

Moves the cursor down by the specified number of lines. Returns {:ok, updated_emulator} or {:error, reason}.

Moves the cursor left by the specified number of columns. Returns {:ok, updated_emulator} or {:error, reason}.

Moves the cursor right by the specified number of columns. Returns {:ok, updated_emulator} or {:error, reason}.

Moves the cursor to the specified position. Returns {:ok, updated_emulator} or {:error, reason}.

Moves the cursor up by the specified number of lines. Returns {:ok, updated_emulator} or {:error, reason}.

Restores the previously saved cursor state. Returns {:ok, updated_emulator} or {:error, reason}.

Saves the current cursor state. Returns {:ok, updated_emulator}.

Sets the cursor style. Returns {:ok, updated_emulator} or {:error, reason}.

Shows the cursor. Returns {:ok, updated_emulator}.

Functions

hide(emulator)

@spec hide(Raxol.Terminal.Core.t()) :: {:ok, Raxol.Terminal.Core.t()}

Hides the cursor. Returns {:ok, updated_emulator}.

move_down(emulator, lines)

@spec move_down(Raxol.Terminal.Core.t(), non_neg_integer()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Moves the cursor down by the specified number of lines. Returns {:ok, updated_emulator} or {:error, reason}.

move_left(emulator, cols)

@spec move_left(Raxol.Terminal.Core.t(), non_neg_integer()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Moves the cursor left by the specified number of columns. Returns {:ok, updated_emulator} or {:error, reason}.

move_right(emulator, cols)

@spec move_right(Raxol.Terminal.Core.t(), non_neg_integer()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Moves the cursor right by the specified number of columns. Returns {:ok, updated_emulator} or {:error, reason}.

move_to(emulator, row, col)

@spec move_to(Raxol.Terminal.Core.t(), non_neg_integer(), non_neg_integer()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Moves the cursor to the specified position. Returns {:ok, updated_emulator} or {:error, reason}.

move_up(emulator, lines)

@spec move_up(Raxol.Terminal.Core.t(), non_neg_integer()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Moves the cursor up by the specified number of lines. Returns {:ok, updated_emulator} or {:error, reason}.

restore_state(emulator)

@spec restore_state(Raxol.Terminal.Core.t()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Restores the previously saved cursor state. Returns {:ok, updated_emulator} or {:error, reason}.

save_state(emulator)

@spec save_state(Raxol.Terminal.Core.t()) :: {:ok, Raxol.Terminal.Core.t()}

Saves the current cursor state. Returns {:ok, updated_emulator}.

set_style(emulator, style)

@spec set_style(Raxol.Terminal.Core.t(), Raxol.Terminal.Core.cursor_style_type()) ::
  {:ok, Raxol.Terminal.Core.t()} | {:error, String.t()}

Sets the cursor style. Returns {:ok, updated_emulator} or {:error, reason}.

show(emulator)

@spec show(Raxol.Terminal.Core.t()) :: {:ok, Raxol.Terminal.Core.t()}

Shows the cursor. Returns {:ok, updated_emulator}.