The Terminal 1. Introduction. A minimal, yet modular X terminal configurable at compile time. Modules are always explicitly compiled together and communicate through C macros and/or inline functions with predefined names. A module implements a part of the desired functionality of a terminal (from now on, called PARTS). Each part might have multiple possible implementations, but in one configuration, only one is active. Each desired capability described in this document has a priority, which is one of the following: MANDATORY Absolutely necessary for even experimenting. IMPORTANT Necessary for the terminal to be usable. DESIRABLE Would be nice to have this capability. OPTIONAL When everything else works. 2. Parts. 2.1. IO This part reads the output of a process and sends keystrokes back - thus communicates with the outside world. For a "tabbed" terminal (handling multiple BUFFERs) more than one IO session can be active. Gets information on keystrokes from DISPLAY. Implementations: IO_STDIO MANDATORY Reads from the standard input of the terminal process and writes to standard output. For testing. One session only. IO_PTY IMPORTANT Opens a PTY and drives a terminal session as a real terminal should. IO_LIB DESIRABLE Exports IO functionality as library functions, so the terminal can be compiled as a shared library and driven with arbitrary data. (For example: for a quake-like game console.) IO_NETWORK OPTIONAL With this, the terminal may directly function as a telnet or SSH client (would be a handy, small replacement for PuTTY on Windows). 2.2. EMULATION This part interprets the data read through the IO part, processes the terminal control sequences, and drives the BUFFER. Implementations: EMU_DUMB MANDATORY A minimal emulator that understands just a small subset of the usual control sequences (such as a linefeed). EMU_LINUX IMPORTANT An emulator that behaves like the linux console (as described in CONSOLE_CODES(4)). EMU_VT100/et al. OPTIONAL Other emulation behaviors for historical/fun purposes. 2.3. BUFFER Data structure and logic maintaining the display state (the text in the terminal, as well as cursor position, current colors, etc). Implementations: BUF_SIMPLE MANDATORY Maintains a single, 80x25 buffer. BUF_REAL IMPORTANT Handles multiple buffers (with one selected as current). Has scrollback memory. 2.4. DISPLAY Displays the state got from BUFFER visually to the user; reads keyboard and other user interface events and handles/dispatches them as necessary (interprets them as terminal control hotkeys, or sends them to IO). Implementations: DSP_X11_SIMPLE MANDATORY Basic display for X-window. Opens a 80x25, unsizable window. Text is drawn using a fixed-width X font. DSP_X11 IMPORTANT Final display for X-window. Supports window resizing, fixed X and console fonts. Supports xterm mouse click events. DSP_SDL DESIRABLE Display to an SDL surface. Used when the terminal is compiled as a shared library: exports functions for control. Draws text using console fonts or a given font surface (a bitmap of X*W x Y*H size, where W/H are character dimensions, with Y rows and X columns of characters in the bitmap; this way handles a 8-bit character set). DSP_WINDOWS OPTIONAL Native windows display (probably used with IO_NETWORK). 3. Configuration. Some possible configuration options of the parts/modules follow. BUFFER: scrollback [IMPORTANT] {CFG_BUFFER_SCROLLBACK} Size of maximum scrollback memory for a buffer (given in lines). BUFFER: enable tabs [IMPORTANT] {CFG_BUFFER_TABS} So one can disable tab support. BUFFER: enable tabbar [DESIRABLE] {CFG_BUFFER_TABBAR} Enables or disables tab bar on the top row of the terminal window. DISPLAY: font [IMPORTANT] {CFG_DISPLAY_NATIVE_FONT; CFG_DISPLAY_VGA_FONT} Selects the font used when rendering text. Might be a standard X11 font string, or the file of a console font. This option would also exist for DSP_WINDOWS (might or might not support a linux console font file); and DSP_SDL (with support for a font surface). DISPLAY: colors [IMPORTANT] {CFG_DISPLAY_COLOR1...CFG_DISPLAY_COLOR16} RGB color values for the 16 terminal colors. DISPLAY: cursor shape [DESIRABLE] {CFG_DISPLAY_CURSOR_SHAPE} Controls the shape of the active and inactive cursors. Possible options may be: CURS_BLOCK (for xterm like block cursor), CURS_COLUMN (column on the left side of the character block, as in gvim), CURS_VGA (bar on the bottom of the character block), CURS_EMPTYBLOCK (for xterm like unfocused empty block cursor) DISPLAY: cursor color [DESIRABLE] {CFG_DISPLAY_CURSOR_COLOR_BG, CFG_DISPLAY_CURSOR_COLOR_FG} Color for the active and inactive cursor. DISPLAY: cursor blink [DESIRABLE] {CFG_DISPLAY_CURSOR_BLINK_PERIOD, CFG_DISPLAY_CURSOR_BLINK_ONTIME} If PERIOD is not 0, the cursor is blinking. The period of the blink is PERIOD ms and the cursor is visible for ONTIME percentage. DISPLAY: reverse mode [DESIRABLE] {CFG_DISPLAY_REVERSE} Reverses colors (black-on-white mode). DISPLAY: lock size [DESIRABLE] {CFG_DISPLAY_LOCK_SIZE} Locks window size at a predefined value (e.g. 80x25). 4. Requirements Software that ABSOLUTELY HAS TO RUN, priority 1: - aptitude Other software that might be useful if it ran: - mc - screen - vim - irssi