Terminal

Encapsulates the I/O capabilities of a terminal.

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.

struct Terminal {}

Constructors

this
this()
Undocumented in source.
this
this(ConsoleOutputType type, int fdIn, int fdOut, int[] delegate() getSizeOverride)
this(ConsoleOutputType type)

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

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Aliases

writeString
deprecated alias writeString = writePrintableString
Undocumented in source.

Functions

autoHideCursor
void autoHideCursor()
Undocumented in source. Be warned that the author may not have intended to support it.
autoShowCursor
void autoShowCursor()
Undocumented in source. Be warned that the author may not have intended to support it.
clear
void clear()

Clears the screen.

color
void color(int foreground, int background, ForceOption force, bool reverseVideo)

Changes the current color. See enum Color for the values.

doTermcap
bool doTermcap(string key, T t)
Undocumented in source. Be warned that the author may not have intended to support it.
findSequenceInTermcap
string findSequenceInTermcap(char[] sequenceIn)
Undocumented in source. Be warned that the author may not have intended to support it.
flush
void 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

getSize
int[] getSize()
Undocumented in source. Be warned that the author may not have intended to support it.
getTermcap
string getTermcap(string key)
Undocumented in source. Be warned that the author may not have intended to support it.
getline
string getline(string prompt)

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
void hideCursor()

hides the cursor

isMacTerminal
bool isMacTerminal()
Undocumented in source. Be warned that the author may not have intended to support it.
moveTo
void moveTo(int x, int y, ForceOption force)

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

readTermcap
void readTermcap()
Undocumented in source. Be warned that the author may not have intended to support it.
reset
void reset()

Returns the terminal to normal output colors

setTitle
void setTitle(string t)

Changes the terminal's title

showCursor
void showCursor()

shows the cursor

terminalInFamily
bool terminalInFamily(string[] terms)
Undocumented in source. Be warned that the author may not have intended to support it.
underline
void underline(bool set, ForceOption force)

Note: the Windows console does not support underlining

updateSize
void updateSize()
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(T t)

Writes to the terminal at the current cursor position.

writePrintableString
void writePrintableString(char[] s, ForceOption force)
Undocumented in source. Be warned that the author may not have intended to support it.
writeStringRaw
void writeStringRaw(char[] s)
Undocumented in source. Be warned that the author may not have intended to support it.
writef
void writef(string f, T t)
writefln
void writefln(string f, T t)
writeln
void writeln(T t)

Writes to the terminal at the current cursor position.

Properties

cursorX
int cursorX [@property getter]

The current x position of the output cursor. 0 == leftmost column

cursorY
int cursorY [@property getter]

The current y position of the output cursor. 0 == topmost row

height
int height [@property getter]

The current height of the terminal (the number of rows)

width
int width [@property getter]

The current width of the terminal (the number of columns)

Static functions

getTermcapDatabase
string getTermcapDatabase(string terminal)
Undocumented in source. Be warned that the author may not have intended to support it.
readTermcapFile
void readTermcapFile(bool useBuiltinTermcap)
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

termcapDatabase
string[string] termcapDatabase;
Undocumented in source.

Variables

_currentBackground
int _currentBackground;
Undocumented in source.
_currentForeground
int _currentForeground;
Undocumented in source.
_suppressDestruction
bool _suppressDestruction;
Undocumented in source.
_wrapAround
bool _wrapAround;
Undocumented in source.
_writeDelegate
void delegate(in void[]) _writeDelegate;
Undocumented in source.
hConsole
HANDLE hConsole;
Undocumented in source.
lineGetter
LineGetter lineGetter;
Undocumented in source.
originalSbi
CONSOLE_SCREEN_BUFFER_INFO originalSbi;
Undocumented in source.
reverseVideo
bool reverseVideo;
Undocumented in source.
termcap
string[string] termcap;
Undocumented in source.

Meta