Raxol.Terminal.Cursor (Raxol v2.0.1)

View Source

Provides cursor manipulation functions for the terminal emulator. This module handles operations like moving the cursor, setting its visibility, and managing cursor state.

Summary

Functions

Gets the current cursor position.

Gets the cursor style.

Moves the cursor backward by the specified number of columns.

Moves the cursor down by the specified number of lines.

Moves the cursor down and to the beginning of the line.

Moves the cursor forward by the specified number of columns.

Moves the cursor left by the specified number of columns.

Moves the cursor relative to its current position.

Moves the cursor right by the specified number of columns.

Moves the cursor to the specified position.

Moves the cursor to the specified row and column.

Moves the cursor to the specified position, taking into account the screen width and height.

Moves the cursor to the specified column.

Moves the cursor up by the specified number of lines.

Moves the cursor up and to the beginning of the line.

Creates a new cursor with default settings.

Resets the cursor color to default.

Restores the cursor to a previously saved position.

Saves the current cursor position.

Sets the cursor blink state.

Sets the cursor color.

Sets the cursor position.

Sets the cursor shape.

Sets the cursor style.

Sets the cursor visibility.

Sets the cursor visibility.

Checks if the cursor is visible.

Types

t()

@type t() :: %Raxol.Terminal.Cursor{
  position: {non_neg_integer(), non_neg_integer()},
  saved_position: {non_neg_integer(), non_neg_integer()} | nil,
  shape: atom(),
  visible: boolean()
}

Functions

get_position(emulator)

Gets the current cursor position.

get_style(emulator)

@spec get_style(Raxol.Terminal.Emulator.Struct.t()) :: map()

Gets the cursor style.

move_backward(emulator, cols)

Moves the cursor backward by the specified number of columns.

move_down(emulator, lines)

Moves the cursor down by the specified number of lines.

move_down_and_home(emulator, lines)

Moves the cursor down and to the beginning of the line.

move_forward(emulator, cols)

Moves the cursor forward by the specified number of columns.

move_left(emulator, cols)

Moves the cursor left by the specified number of columns.

move_relative(cursor, dx, dy)

@spec move_relative(t(), integer(), integer()) :: t()

Moves the cursor relative to its current position.

move_right(emulator, cols)

Moves the cursor right by the specified number of columns.

move_to(emulator, arg)

Moves the cursor to the specified position.

move_to(emulator, row, col)

Moves the cursor to the specified row and column.

move_to(cursor, arg, width, height)

@spec move_to(
  t(),
  {non_neg_integer(), non_neg_integer()},
  non_neg_integer(),
  non_neg_integer()
) :: t()

Moves the cursor to the specified position, taking into account the screen width and height.

move_to_column(emulator, col)

Moves the cursor to the specified column.

move_up(emulator, lines)

Moves the cursor up by the specified number of lines.

move_up_and_home(emulator, lines)

Moves the cursor up and to the beginning of the line.

new()

@spec new() :: t()

Creates a new cursor with default settings.

reset_color(emulator)

Resets the cursor color to default.

restore(cursor, saved_cursor)

@spec restore(t(), t()) :: t()

Restores the cursor to a previously saved position.

save(cursor)

@spec save(t()) :: t()

Saves the current cursor position.

set_blink(emulator, blink)

Sets the cursor blink state.

set_color(emulator, color)

Sets the cursor color.

set_position(emulator, position)

Sets the cursor position.

set_shape(emulator, shape)

Sets the cursor shape.

set_style(emulator, style)

Sets the cursor style.

set_visibility(emulator, visible)

Sets the cursor visibility.

set_visible(emulator, visible)

Sets the cursor visibility.

visible?(emulator)

@spec visible?(Raxol.Terminal.Emulator.Struct.t()) :: boolean()

Checks if the cursor is visible.