Anansi v0.0.2 Anansi.Cursor

ANSI escape codes that manipulate the terminal cursor.

ANSI treats the cursor co-ordinates as positive integers of format {row in 1..∞, col in 1..∞}.

It will ignore requests to move the cursor beyond the bounds of the terminal window.

Summary

Functions

Moves cursor left by amount

Moves cursor left by amount

Moves cursor left by amount

Move cursor to col of the current row

Moves cursor down by amount

Erases entire thing around cursor

Erases thing around the cursor in the specified way

Moves cursor right by amount

Moves cursor right by amount

Hides the cursor

Moves cursor to top-left corner of screen ({1, 1})

Moves cursor left by amount

Moves cursor forwards

Moves cursor in direction

Moves cursor in direction by amount

Moves cursor right by amount

Asks the terminal to report the current cursor position

Move cursor to position {row, col}.

Moves cursor left by amount

Moves the cursor to saved position

Moves cursor right by amount

Move cursor to row of the current column

Saves the cursor position

Shows the cursor

Moves cursor up by amount

Functions

back(amount \\ 1)

Moves cursor left by amount.

backward(amount \\ 1)

Moves cursor left by amount.

backwards(amount \\ 1)

Moves cursor left by amount.

col(col)

Move cursor to col of the current row.

down(amount \\ 1)

Moves cursor down by amount.

erase(thing)

Erases entire thing around cursor.

Supported things: :screen, :line.

Additionally, the thing can be a keyword list of things and ways to erase via erase/2.

erase(thing, way)

Erases thing around the cursor in the specified way.

You can erase :all around the cursor, or just erase to :start or :end of thing.

Supported things: :screen, :line.

forward(amount \\ 1)

Moves cursor right by amount.

forwards(amount \\ 1)

Moves cursor right by amount.

hide()

Hides the cursor.

home()

Moves cursor to top-left corner of screen ({1, 1}).

left(amount \\ 1)

Moves cursor left by amount.

move()

Moves cursor forwards.

move(direction)

Moves cursor in direction.

Allowed directions: :up, :down, :right, or :left.

The :right direction is aliased as :forward, :forwards, and :next.

The :left direction is aliased as :backward, :backwards, :back, and :prev.

Alternatively, the direction can be a keyword list of directions and amounts to move via move/2.

move(direction, amount)

Moves cursor in direction by amount.

Allowed directions: :up, :down, :right, or :left.

The :right direction is aliased as :forward, :forwards, and :next.

The :left direction is aliased as :backward, :backwards, :back, and :prev.

Additionally, the :pos direction will move to a supplied {row, col} location, and the :row and :col directions will set that co-ordinate to amount and the other to 1.

next(amount \\ 1)

Moves cursor right by amount.

position()

Asks the terminal to report the current cursor position.

Terminal will insert "\e[n;mR" into the input device where n is the row and m the column.

position(arg)

Move cursor to position {row, col}.

prev(amount \\ 1)

Moves cursor left by amount.

restore()

Moves the cursor to saved position.

right(amount \\ 1)

Moves cursor right by amount.

row(row)

Move cursor to row of the current column.

save()

Saves the cursor position.

show()

Shows the cursor.

up(amount \\ 1)

Moves cursor up by amount.