View Source Garnish.TermInfo behaviour (garnish v0.2.0)

A behaviour for defining the terminfo sequences a 'terminal' module should support.

Summary

Callbacks

Make the cursor invisible

Clear the screen

Restore the cursor

Return the number of colors supported by the terminal

Move the cursor to the specified position

Returns the keymap for the terminal

Restore the main buffer

Restore the terminal mode

Set the background color

Set the foreground color

Clear the graphic attributes

Set the graphic attributes

Save the main buffer and switch to the alternate buffer

Set the terminal to application mode

Functions

Look up the terminal module by name, returning nil if not supported.

Callbacks

@callback civis() :: binary()

Make the cursor invisible

@callback clear() :: binary()

Clear the screen

@callback cnorm() :: binary()

Restore the cursor

@callback colors() :: non_neg_integer()

Return the number of colors supported by the terminal

@callback cup(row :: non_neg_integer(), col :: non_neg_integer()) :: binary()

Move the cursor to the specified position

@callback get_keymap() :: %{required(String.t()) => :atom}

Returns the keymap for the terminal

@callback rmcup() :: binary()

Restore the main buffer

@callback rmkx() :: binary()

Restore the terminal mode

@callback setab(bg :: non_neg_integer()) :: binary()

Set the background color

@callback setaf(fg :: non_neg_integer()) :: binary()

Set the foreground color

@callback sgr0() :: binary()

Clear the graphic attributes

@callback sgr(flags :: non_neg_integer()) :: binary()

Set the graphic attributes

@callback smcup() :: binary()

Save the main buffer and switch to the alternate buffer

@callback smkx() :: binary()

Set the terminal to application mode

Functions

@spec lookup(name :: String.t()) :: module() | nil

Look up the terminal module by name, returning nil if not supported.