Struct Terminal

Encapsulates the I/O capabilities of a terminal.

struct Terminal ;

Constructors

NameDescription
this
this Constructs an instance of Terminal representing the capabilities of the current terminal.

Properties

NameTypeDescription
cursorX[get] intThe current x position of the output cursor. 0 == leftmost column
cursorY[get] intThe current y position of the output cursor. 0 == topmost row
height[get] intThe current height of the terminal (the number of rows)
width[get] intThe current width of the terminal (the number of columns)

Methods

NameDescription
clear Clears the screen.
color Changes the current color. See enum Color for the values.
flush Flushes your updates to the terminal. It is important to call this when you are finished writing for now if you are using the version=with_eventloop
getline gets a line, including user editing. Convenience method around the LineGetter class and RealTimeConsoleInput facilities - use them if you need more control. You really shouldn't call this if stdin isn't actually a user-interactive terminal! So if you expect people to pipe data to your app, check for that or use something else.
hideCursor hides the cursor
moveTo Moves the output cursor to the given position. (0, 0) is the upper left corner of the screen. The force parameter can be used to force an update, even if Terminal doesn't think it is necessary
reset Returns the terminal to normal output colors
setTitle Changes the terminal's title
setTrueColor Attempts to set color according to a 24 bit value (r, g, b, each >= 0 and < 256).
showCursor shows the cursor
underline
write Writes to the terminal at the current cursor position.
writef Writes to the terminal at the current cursor position.
writefln Writes to the terminal at the current cursor position.
writeln Writes to the terminal at the current cursor position.

Aliases

NameDescription
writeString use write() or writePrintableString instead

Warning

do not write out escape sequences to the terminal. This won't work on Windows and will confuse Terminal's internal state on Posix.