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

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

civis()

@callback civis() :: binary()

Make the cursor invisible

clear()

@callback clear() :: binary()

Clear the screen

cnorm()

@callback cnorm() :: binary()

Restore the cursor

colors()

@callback colors() :: non_neg_integer()

Return the number of colors supported by the terminal

cup(row, col)

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

Move the cursor to the specified position

get_keymap()

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

Returns the keymap for the terminal

rmcup()

@callback rmcup() :: binary()

Restore the main buffer

rmkx()

(optional)
@callback rmkx() :: binary()

Restore the terminal mode

setab(bg)

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

Set the background color

setaf(fg)

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

Set the foreground color

sgr0()

@callback sgr0() :: binary()

Clear the graphic attributes

sgr(flags)

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

Set the graphic attributes

smcup()

@callback smcup() :: binary()

Save the main buffer and switch to the alternate buffer

smkx()

(optional)
@callback smkx() :: binary()

Set the terminal to application mode

Functions

lookup(name)

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

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