Raxol.Terminal.Cursor.Manager (Raxol v2.0.1)

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 current cursor position.

Gets the cursor position as a tuple {row, col}.

Gets the cursor visibility state.

Moves the cursor relative to its current position.

Moves the cursor down by the specified number of lines. Returns the updated emulator.

Moves the cursor left by the specified number of columns. Returns the updated emulator.

Moves the cursor right by the specified number of columns. Returns the updated emulator.

Moves the cursor to a specific position.

Moves the cursor to a specific position with bounds clamping.

Moves the cursor up by the specified number of lines. Returns the updated emulator.

Creates a new cursor manager instance.

Creates a new cursor manager.

Sets the cursor position.

Sets the cursor visibility state.

Updates the cursor position after a resize operation. Returns the updated emulator.

Updates the scroll region after a resize operation. Returns the updated emulator.

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: boolean(),
  blink_rate: non_neg_integer(),
  blink_timer: non_neg_integer() | nil,
  blinking: boolean(),
  bottom_margin: non_neg_integer(),
  col: non_neg_integer(),
  color: color(),
  custom_dimensions: {non_neg_integer(), non_neg_integer()} | nil,
  custom_shape: atom() | nil,
  history: list(),
  history_index: non_neg_integer(),
  history_limit: non_neg_integer(),
  position: {non_neg_integer(), non_neg_integer()},
  row: non_neg_integer(),
  saved_blinking: boolean() | nil,
  saved_col: non_neg_integer() | nil,
  saved_color: color() | nil,
  saved_position: {non_neg_integer(), non_neg_integer()} | nil,
  saved_row: non_neg_integer() | nil,
  saved_style: cursor_style() | nil,
  saved_visible: boolean() | nil,
  shape: {non_neg_integer(), non_neg_integer()},
  state: atom(),
  style: cursor_style(),
  top_margin: non_neg_integer(),
  visible: boolean()
}

Functions

add_to_history(state)

See Raxol.Terminal.Cursor.CursorState.add_to_history/1.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

constrain_position(cursor, width, height)

See Raxol.Terminal.Cursor.Movement.constrain_position/3.

emulator_blinking?(emulator)

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

emulator_visible?(emulator)

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

get_blink(pid \\ __MODULE__)

get_color(state)

get_emulator_position(emulator)

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

get_emulator_style(emulator)

@spec get_emulator_style(Raxol.Terminal.Emulator.t()) :: atom()

get_margins(cursor)

See Raxol.Terminal.Cursor.CursorState.get_margins/1.

get_position(pid \\ __MODULE__)

Gets the current cursor position.

get_position_tuple(cursor)

Gets the cursor position as a tuple {row, col}.

get_state(pid)

get_style(pid \\ __MODULE__)

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(emulator, count \\ 1)

Moves the cursor down by the specified number of lines. Returns the updated emulator.

move_down(cursor, lines, width, height)

See Raxol.Terminal.Cursor.Movement.move_down/4.

move_home(cursor, width, height)

See Raxol.Terminal.Cursor.Movement.move_home/3.

move_left(emulator, count \\ 1)

Moves the cursor left by the specified number of columns. Returns the updated emulator.

move_left(cursor, cols, width, height)

See Raxol.Terminal.Cursor.Movement.move_left/4.

move_right(emulator, count \\ 1)

Moves the cursor right by the specified number of columns. Returns the updated emulator.

move_right(cursor, cols, width, height)

See Raxol.Terminal.Cursor.Movement.move_right/4.

move_to(cursor, row, col)

Moves the cursor to a specific position.

move_to(cursor, row, col, width, height)

Moves the cursor to a specific position with bounds clamping.

move_to_column(cursor, column)

See Raxol.Terminal.Cursor.Movement.move_to_column/2.

move_to_column(cursor, column, width, height)

See Raxol.Terminal.Cursor.Movement.move_to_column/4.

move_to_line(cursor, line)

See Raxol.Terminal.Cursor.Movement.move_to_line/2.

move_to_line_end(cursor, line_width)

See Raxol.Terminal.Cursor.Movement.move_to_line_end/2.

move_to_line_start(cursor)

See Raxol.Terminal.Cursor.Movement.move_to_line_start/1.

move_to_next_tab(cursor, tab_size, width, height)

See Raxol.Terminal.Cursor.Movement.move_to_next_tab/4.

move_to_prev_tab(cursor, tab_size, width, height)

See Raxol.Terminal.Cursor.Movement.move_to_prev_tab/4.

move_up(emulator, count \\ 1)

Moves the cursor up by the specified number of lines. Returns the updated emulator.

move_up(cursor, lines, width, height)

See Raxol.Terminal.Cursor.Movement.move_up/4.

new()

Creates a new cursor manager instance.

new(opts)

Creates a new cursor manager.

new(row, col)

reset(state)

See Raxol.Terminal.Cursor.CursorState.reset/1.

reset_color(state)

reset_position(pid \\ __MODULE__)

restore_from_history(state)

See Raxol.Terminal.Cursor.CursorState.restore_from_history/1.

restore_position(state)

See Raxol.Terminal.Cursor.CursorState.restore_position/1.

restore_state(state)

See Raxol.Terminal.Cursor.CursorState.restore_state/1.

save_position(state)

See Raxol.Terminal.Cursor.CursorState.save_position/1.

save_state(state)

See Raxol.Terminal.Cursor.CursorState.save_state/1.

set_blink(pid \\ __MODULE__, blink)

set_color(state, color)

set_custom_shape(shape, params)

set_custom_shape(state, shape, params)

See Raxol.Terminal.Cursor.CursorState.set_custom_shape/3.

set_emulator_blink(emulator, blinking)

@spec set_emulator_blink(Raxol.Terminal.Emulator.t(), boolean()) ::
  Raxol.Terminal.Emulator.t()

set_emulator_position(emulator, x, y)

set_emulator_style(emulator, style)

@spec set_emulator_style(Raxol.Terminal.Emulator.t(), atom()) ::
  Raxol.Terminal.Emulator.t()

set_emulator_visibility(emulator, visible)

@spec set_emulator_visibility(Raxol.Terminal.Emulator.t(), boolean()) ::
  Raxol.Terminal.Emulator.t()

set_margins(cursor, top, bottom)

See Raxol.Terminal.Cursor.CursorState.set_margins/3.

set_position(pid, arg2)

Sets the cursor position.

set_state(pid, state_atom)

set_style(style)

set_style(state, style)

set_visibility(pid \\ __MODULE__, visible)

Sets the cursor visibility state.

start_link(init_opts \\ [])

update_blink()

update_blink(state)

See Raxol.Terminal.Cursor.CursorState.update_blink/1.

update_cursor_position(emulator, new_width, new_height)

Updates the cursor position after a resize operation. Returns the updated emulator.

update_position(pid \\ __MODULE__, position)

update_position_from_text(cursor, text)

See Raxol.Terminal.Cursor.CursorState.update_position_from_text/2.

update_scroll_region_for_resize(emulator, new_height)

@spec update_scroll_region_for_resize(Raxol.Terminal.Emulator.t(), non_neg_integer()) ::
  Raxol.Terminal.Emulator.t()

Updates the scroll region after a resize operation. Returns the updated emulator.