Autofonce_lib.Terminalinclude module type of struct include ANSITerminal endtype color = ANSITerminal.color = Available colors.
type style = ANSITerminal.style = Various styles for the text. Blink and Hidden may not work on every terminal.
val black : styleShortcut for Foreground Black
val red : styleShortcut for Foreground Red
val green : styleShortcut for Foreground Green
val yellow : styleShortcut for Foreground Yellow
val blue : styleShortcut for Foreground Blue
val magenta : styleShortcut for Foreground Magenta
val cyan : styleShortcut for Foreground Cyan
val white : styleShortcut for Foreground White
val default : styleShortcut for Foreground Default
val on_black : styleShortcut for Background Black
val on_red : styleShortcut for Background Red
val on_green : styleShortcut for Background Green
val on_yellow : styleShortcut for Background Yellow
val on_blue : styleShortcut for Background Blue
val on_magenta : styleShortcut for Background Magenta
val on_cyan : styleShortcut for Background Cyan
val on_white : styleShortcut for Background White
val on_default : styleShortcut for Background Default
val print_string : style list -> string -> unitprint_string attr txt prints the string txt with the attibutes attr. After printing, the attributes are automatically reseted to the defaults, unless autoreset is turned off.
val prerr_string : style list -> string -> unitLike print_string but prints on the standard error.
val printf : style list -> ('a, unit, string, unit) Stdlib.format4 -> 'aprintf attr format arg1 ... argN prints the arguments arg1,...,argN according to format with the attibutes attr. After printing, the attributes are automatically reseted to the defaults, unless autoreset is turned off.
val eprintf : style list -> ('a, unit, string, unit) Stdlib.format4 -> 'aSame as printf but prints the result on stderr.
val sprintf : style list -> ('a, unit, string) Stdlib.format -> 'aSame as printf but returns the result in a string. This only works on ANSI compliant terminals — for which escape sequences are used — and not under Windows — where system calls are required. On Windows, it is identical to the standard sprintf.
val erase : loc -> uniterase Eol clear from the cursor position to the end of the line without moving the cursor. erase Above erases everything before the position of the cursor. erase Below erases everything after the position of the cursor. erase Screen erases the whole screen.
This function does not modify the position of the cursor.
set_cursor x y puts the cursor at position (x,y), x indicating the column (the leftmost one being 1) and y being the line (the topmost one being 1). If x <= 0, the x coordinate is unchanged; if y <= 0, the y coordinate is unchanged.
move_cursor x y moves the cursor by x columns (to the right if x > 0, to the left if x < 0) and by y lines (downwards if y > 0 and upwards if y < 0).
pos_cursor() returns a couple (x,y) giving the current position of the cursor, x >= 1 being the column and y >= 1 the row.
restore_cursor() replaces the cursor to the position saved with save_cursor().
resize width height resize the current terminal to the given width and height.
size() returns a pair (width, height) giving the size of the terminal in character cells.
scroll n scrolls the terminal by n lines, up (creating new lines at the bottom) if n > 0 and down if n < 0.