Ansi cursor

ansi_is_supported

Return 0 if the terminal supports ANSI escape sequences. Checks TERM, COLORTERM, and whether stdout is a tty.

Exit codes

  • 0: Supported; 1 Not supported

ansi_cursor_up

Move cursor up N lines.

Arguments

  • $1 (int): Lines (default: 1)

ansi_cursor_down

Move cursor down N lines.

Arguments

  • $1 (int): Lines (default: 1)

ansi_cursor_forward

Move cursor forward (right) N columns.

Arguments

  • $1 (int): Columns (default: 1)

ansi_cursor_backward

Move cursor backward (left) N columns.

Arguments

  • $1 (int): Columns (default: 1)

ansi_cursor_position

Move cursor to an absolute position (1-based row, col).

Arguments

  • $1 (int): Row (default: 1)
  • $2 (int): Column (default: 1)

ansi_cursor_save

Save current cursor position (DECSC).

ansi_cursor_restore

Restore saved cursor position (DECRC).

ansi_cursor_hide

Hide the cursor.

ansi_cursor_show

Show the cursor.

ansi_erase_to_eol

Erase from cursor to end of line.

ansi_erase_line

Erase the entire current line.

ansi_erase_to_eos

Erase from cursor to end of screen.

ansi_erase_screen

Erase the entire visible screen (cursor stays).

ansi_scroll_up

Scroll terminal up N lines (new blank lines at bottom).

Arguments

  • $1 (int): Lines (default: 1)

ansi_scroll_down

Scroll terminal down N lines (new blank lines at top).

Arguments

  • $1 (int): Lines (default: 1)

ansi_title

Set the terminal window title (xterm-compatible).

Arguments

  • $1 (string): Title string

ansi_bell

Ring the terminal bell.

ansi_reset

Full terminal reset (RIS — Return to Initial State).