NAME
vt100 - interface with the terminal through text-based commands
DESCRIPTION
The VT100 terminal specification is a common method of interfacing with the terminal on UNIX-like systems. It provides a simple yet powerful textual control scheme through the use of certain commands written to the terminal through, for example, io.write.
COMMANDS
Monolith's VT100 implementation provides the following escape codes. Each is documented appropriately.
{ESC} is used to reference the ASCII escape character, 0x1b or \\27.
All numbers, unless otherwise specified, default to 1. Return values are usually read through io.read.
{ESC}[nnA
Move the cursor up nn rows.
{ESC}[nnB
Move the cursor down nn rows.
{ESC}[nnC
Move the cursor forward nn columns.
{ESC}[nnD
Move the cursor backward nn columns.
{ESC}[nnE
Moves the cursor down nn lines and sets the cursor position to column 1.
{ESC}[nnF
Moves the cursor up nn lines and sets the cursor position to column 1.
{ESC}[yy;xxf
Identical to {ESC}[xx;yyH.
{ESC}[xxG
Moves the cursor to X coordinate xx.
{ESC}[yy;xxH
Move the cursor to row yy, column xx. Does not scroll or go off-screen.
{ESC}[nnJ
Clears portions of the screen. nn defaults to 0.
If nn is 0, clears the screen from the current cursor position to the bottom.
If nn is 1, clears the screen from the top to the current cursor position.
If nn is 2, clears the entire screen. Resets the cursor position to 1, 1.
{ESC}[nnK
Clears portions of the current line. nn defaults to 0.
If nn is 0, clears the current line from the current cursor position to the end of the line.
If nn is 1, clears the current line from the beginning of the line to the current cursor position.
If nn is 2, clears the entire current line.
{ESC}[aa;bb;cc;...m
Sets and unsets various terminal attributes such as text color. Accepts multiple arguments per call.
Each argument is interpreted individually.
If the argument is in the range 30-37 or 90-97, sets the text foreground color. See COLORS below.
If the argument is in the range 40-47 or 100-107, sets the text background color. See COLORS below.
If the argument is 0, resets all attributes - local echo, foreground, and background.
If the argument is 7 or 27, switches the foreground and background colors.
If the argument is 8, disables local echo.
If the argument is 28, enables local echo.
{ESC}[nnn
If nn is 6, returns the current cursor position as {ESC}[yy;xxR.
{ESC}[S
Scrolls the terminal down one line. Does not restore previous content.
{ESC}[nns
Saves the current cursor position.
{ESC}[T
Scrolls the terminal up one line. Does not restore previous content.
{ESC}[nnu
Restores the saved cursor position.
{ESC}D
Identical to {ESC}[S.
{ESC}M
Identical to {ESC}[T.
{ESC}7
Identical to {ESC}[s.
{ESC}8
Identical to {ESC}[u.
{ESC}(l
Disables line mode. Allows reading single characters from the terminal buffer.
{ESC}(L
Enables line mode. Only allows reading single characters from the last entered line.
{ESC}(r
Disables raw mode.
{ESC}(R
Enables raw mode. Disables actions on any special keys or characters such as the newline (\\10).
{ESC}(B
If GPU buffers are available, redirects all terminal output to the buffer. Useful for full-screen commands such as vled or less.
{ESC}(b
If GPU buffers are available, redirect output back to the screen and bitblt the terminal buffer to the screen.
COLORS
Monolith's VT100 emulator supports both standard and "bright" colors. Standard colors are accessed in the ranges 30-37 (foreground) and 40-47 (background), and bright colors are accessed by adding 60 to the color value. Colors can be configured through /etc/vtcolors.cfg.
As of Monolith 2020.10.17, the terminal supports selecting a single color from the ANSI-standard 256-color palette through {ESC}[38;2;INDEXm for the foreground color and {ESC}[48;2;INDEXm for the background color, as well as selecting a 24-bit RGB color through {ESC}[38;5;RRR;GGG;BBBm for through a foreground and {ESC}[48;5;RRR;GGG;BBBm for the background color.
Color codes, their names, and their default hexvalues (in 24-bit RGB format) follow.
FORMAT
fg/bg name hexvalue
STANDARD
30/40 Black 0x000000
31/41 Red 0xDD0000
32/42 Green 0x00DD00
33/43 Yellow 0xDDDD00
34/44 Blue 0x0066DD
35/45 Purple 0xDD00DD
36/46 Cyan 0x00DDDD
37/47 White 0xEEEEEE
BRIGHT
90/100 Black 0x111111
91/101 Red 0xFF0000
92/102 Green 0x00FF00
93/103 Yellow 0xFFFF00
94/104 Blue 0x0077FF
95/105 Purple 0xFF00FF
96/106 Cyan 0x00FFFF
97/107 White 0xFFFFFF
NOTES
As of the transition to the Paragon terminal emulator in Monolith 2020.10.17, terminal I/O has undergone a significant restructuring for the sake of sanity. Terminal control codes for line mode, the full-screen buffer, and raw mode have been added. 256-color and RGB-color support has been added. Support for 5n and c has been dropped.
GPU buffers are available in OpenComputers 1.7.9.208 and later. The latest builds may be obtained through the mod's Jenkins, at https://ci.cil.li.
COPYRIGHT
Monolith System Interfaces (c) 2020 Ocawesome101 under the GNU GPLv3.