Cursor-control output sequences.
Every function returns the bytes of a control sequence for you to write to the terminal; the library performs no IO of its own. Positions are 1-based, matching the terminal's own convention.
transport_write([Vtex.Output.Cursor.to(1, 1), Vtex.Output.Cursor.hide()])
Summary
Functions
Move the cursor to col on the current row (1-based).
Hide the cursor.
Move the cursor n cells in a direction (:up, :down, :left, :right).
Show the cursor.
Move the cursor to row, col (both 1-based).
Functions
@spec column(pos_integer()) :: binary()
Move the cursor to col on the current row (1-based).
Examples
iex> Vtex.Output.Cursor.column(1)
"\e[1G"
@spec hide() :: binary()
Hide the cursor.
Examples
iex> Vtex.Output.Cursor.hide()
"\e[?25l"
@spec move(:up | :down | :left | :right, pos_integer()) :: binary()
Move the cursor n cells in a direction (:up, :down, :left, :right).
Examples
iex> Vtex.Output.Cursor.move(:up, 3)
"\e[3A"
iex> Vtex.Output.Cursor.move(:right)
"\e[1C"
@spec restore() :: binary()
Restore the cursor position saved by save/0 (DECRC).
Examples
iex> Vtex.Output.Cursor.restore()
"\e8"
@spec save() :: binary()
Save the cursor position (DECSC). Pair with restore/0.
Examples
iex> Vtex.Output.Cursor.save()
"\e7"
@spec show() :: binary()
Show the cursor.
Examples
iex> Vtex.Output.Cursor.show()
"\e[?25h"
@spec to(pos_integer(), pos_integer()) :: binary()
Move the cursor to row, col (both 1-based).
Examples
iex> Vtex.Output.Cursor.to(5, 10)
"\e[5;10H"