Terminal

Struct containing information and helpers to handle terminals

Most of the control sequences can be prefixed with a ASCII digit string (referred to by 'n' from now on) representing usually how often the command should be executed.

Cases where this is not the case are documented.

Members

Enums

Colour
enum Colour

Colour arrays, one for foreground and one for background colours Each uses the Colour enum values as index

Static variables

bg_colour_codes
immutable(string[]) bg_colour_codes;
Undocumented in source.
columns
ushort columns;

Amount of columns available in the terminal

fg_colour_codes
immutable(string[]) fg_colour_codes;
Undocumented in source.
rows
ushort rows;

Amount of rows (lines) available in the terminal

Structs

Background
struct Background
Undocumented in source.
Foreground
struct Foreground

Colours

Variables

BOLD
enum string BOLD;

Bold / non-bold text.

CSI
enum string CSI;

Start Sequence

CURSOR_UP
enum string CURSOR_UP;

Command for cursor up

ERASE_REST_OF_LINE
enum string ERASE_REST_OF_LINE;

Command for erasing the rest of the line

ERASE_REST_OF_SCREEN
enum string ERASE_REST_OF_SCREEN;

Command for erasing everything below and right of the cursor

HIDE_CURSOR
enum string HIDE_CURSOR;

Command for hiding the cursor

HORIZONTAL_MOVE_CURSOR
enum string HORIZONTAL_MOVE_CURSOR;

Moves the cursor to column n.

INSERT_LINE
enum string INSERT_LINE;

Command for inserting a line

LINE_UP
enum string LINE_UP;

Moves the cursor n lines up and places it at the beginning of the line

NON_BOLD
enum string NON_BOLD;
Undocumented in source.
SCROLL_UP
enum string SCROLL_UP;

Command for scrolling up

SHOW_CURSOR
enum string SHOW_CURSOR;

Command for showing the cursor

Examples

// Move the cursor four lines up
Stdout.formatln("{}4{}", Terminal.CSI, Terminal.CURSOR_UP);

Meta