Raxol.Terminal.Buffer.Manager.Cursor (Raxol v0.4.0)

View Source

Handles cursor management for the terminal buffer. Provides functionality for cursor position tracking and movement.

Summary

Functions

Gets the current cursor position.

Moves the cursor relative to its current position.

Moves the cursor to the bottom of the screen.

Moves the cursor to the end of the line.

Moves the cursor to the beginning of the line.

Moves the cursor to the top of the screen.

Sets the cursor position in the buffer state.

Functions

get_position(state)

Gets the current cursor position.

Examples

iex> state = State.new(80, 24)
iex> Cursor.get_position(state)
{0, 0}

move(state, dx, dy)

Moves the cursor relative to its current position.

Examples

iex> state = State.new(80, 24)
iex> state = Cursor.move(state, 5, 3)
iex> Cursor.get_position(state)
{5, 3}

move_to_bottom(state)

Moves the cursor to the bottom of the screen.

Examples

iex> state = State.new(80, 24)
iex> state = Cursor.set_position(state, 10, 5)
iex> state = Cursor.move_to_bottom(state)
iex> Cursor.get_position(state)
{10, 23}

move_to_line_end(state)

Moves the cursor to the end of the line.

Examples

iex> state = State.new(80, 24)
iex> state = Cursor.set_position(state, 10, 5)
iex> state = Cursor.move_to_line_end(state)
iex> Cursor.get_position(state)
{79, 5}

move_to_line_start(state)

Moves the cursor to the beginning of the line.

Examples

iex> state = State.new(80, 24)
iex> state = Cursor.set_position(state, 10, 5)
iex> state = Cursor.move_to_line_start(state)
iex> Cursor.get_position(state)
{0, 5}

move_to_top(state)

Moves the cursor to the top of the screen.

Examples

iex> state = State.new(80, 24)
iex> state = Cursor.set_position(state, 10, 5)
iex> state = Cursor.move_to_top(state)
iex> Cursor.get_position(state)
{10, 0}

set_position(state, x, y)

Sets the cursor position in the buffer state.

Examples

iex> state = State.new(80, 24)
iex> state = Cursor.set_position(state, 10, 5)
iex> Cursor.get_position(state)
{10, 5}