Raxol.Terminal.Cursor.Manager (Raxol v0.5.0)

View Source

Manages cursor state and operations in the terminal. Handles cursor position, visibility, style, and blinking state.

Summary

Functions

Returns a specification to start this module under a supervisor.

Gets the cursor blinking state.

Gets the cursor color.

Gets the cursor margins.

Gets the current cursor position.

Gets the cursor style.

Gets the cursor visibility state.

Moves the cursor relative to its current position.

Moves the cursor down by the specified number of lines.

Moves the cursor to the home position (0, 0).

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 the specified column.

Moves the cursor to the specified line.

Moves the cursor to the end of the line.

Moves the cursor to the beginning of the line.

Moves the cursor to the next tab stop.

Moves the cursor to the previous tab stop.

Moves the cursor up by the specified number of lines.

Creates a new cursor manager instance.

Creates a new cursor struct with the given options.

Resets the cursor state to default values.

Resets the cursor color to default.

Restores the saved cursor state.

Saves the current cursor state.

Sets the cursor blinking state.

Sets the cursor color.

Sets the cursor margins.

Sets the cursor position.

Sets the cursor state based on a state atom. Supported states: :visible, :hidden

Sets the cursor style.

Sets the cursor visibility state.

Types

color()

@type color() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()} | nil

cursor_style()

@type cursor_style() :: :block | :underline | :bar

t()

@type t() :: %Raxol.Terminal.Cursor.Manager{
  blink_timer: non_neg_integer() | nil,
  blinking: boolean(),
  bottom_margin: non_neg_integer(),
  color: color(),
  saved_blinking: boolean() | nil,
  saved_color: color() | nil,
  saved_style: cursor_style() | nil,
  saved_visible: boolean() | nil,
  saved_x: non_neg_integer() | nil,
  saved_y: non_neg_integer() | nil,
  style: cursor_style(),
  top_margin: non_neg_integer(),
  visible: boolean(),
  x: non_neg_integer(),
  y: non_neg_integer()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_blink(pid \\ __MODULE__)

Gets the cursor blinking state.

get_color(state)

Gets the cursor color.

get_margins(cursor)

Gets the cursor margins.

get_position(pid \\ __MODULE__)

Gets the current cursor position.

get_style(pid \\ __MODULE__)

Gets the cursor style.

get_visibility(pid \\ __MODULE__)

Gets the cursor visibility state.

move_cursor(pid \\ __MODULE__, direction, count \\ 1)

Moves the cursor relative to its current position.

move_down(cursor, lines, width, height)

Moves the cursor down by the specified number of lines.

move_home(cursor, width, height)

Moves the cursor to the home position (0, 0).

move_left(cursor, cols, width, height)

Moves the cursor left by the specified number of columns.

move_right(cursor, cols, width, height)

Moves the cursor right by the specified number of columns.

move_to(cursor, row, col)

Moves the cursor to a specific position.

move_to_column(cursor, column)

Moves the cursor to the specified column.

move_to_line(cursor, line)

Moves the cursor to the specified line.

move_to_line_end(cursor, line_width)

Moves the cursor to the end of the line.

move_to_line_start(cursor)

Moves the cursor to the beginning of the line.

move_to_next_tab(cursor, tab_size, width, height)

Moves the cursor to the next tab stop.

move_to_prev_tab(cursor, tab_size, width, height)

Moves the cursor to the previous tab stop.

move_up(cursor, lines, width, height)

Moves the cursor up by the specified number of lines.

new()

Creates a new cursor manager instance.

new(opts)

Creates a new cursor struct with the given options.

reset(state)

Resets the cursor state to default values.

reset_color(state)

Resets the cursor color to default.

reset_position(pid \\ __MODULE__)

restore_state(state)

Restores the saved cursor state.

save_state(state)

Saves the current cursor state.

set_blink(pid \\ __MODULE__, blink)

Sets the cursor blinking state.

set_color(state, color)

Sets the cursor color.

set_custom_shape(pid \\ __MODULE__, shape, params)

set_margins(cursor, top, bottom)

Sets the cursor margins.

set_position(pid \\ __MODULE__, arg)

Sets the cursor position.

set_state(state, atom)

Sets the cursor state based on a state atom. Supported states: :visible, :hidden

set_style(pid \\ __MODULE__, style)

Sets the cursor style.

set_visibility(pid \\ __MODULE__, visible)

Sets the cursor visibility state.

start_link(opts \\ [])

update_blink(pid \\ __MODULE__)

update_position(pid \\ __MODULE__, arg)