Eterm Technical Reference

This document covers the technical aspects of Eterm, including escape sequences it supports, "under-the-hood" descriptions of certain Eterm features, etc. Portions of this document were taken from the XTerm documentation.

Table of Contents

  1. Document Conventions
  2. Symbols
  3. Escape Sequences
  4. Key Sequences
  5. Eterm Extensions, Standards, and Implementations

Document Conventions

Convention Meaning
c A literal. It should be typed as shown.
SYM A symbol. Replace with the proper character. See the symbol table below for a listing of the symbols used and their meanings.
text A parameter. Replace the italicized text with a parameter. The text itself generally describes the type of parameter needed.
[ ... ] Items enclosed in brackets are optional.
{ ... | ... } Items inclosed in braces and separated by pipes indicate that exactly one of the items should be chosen.

Symbols

Symbol Meaning
BEL Bell (Ctrl-G)
BS Backspace (Ctrl-H)
CR Carriage Return (Ctrl-M)
ENQ Enquiry (Ctrl-E), Send Device Attributes (DA). Eterm ignores ENQ if NO_ENQ_ANS is defined, which it is by default in src/feature.h.
ESC Escape (Ctrl-[)
FF or NP Form Feed or New Page(Ctrl-L)
LF or NL Line Feed or New Line (Ctrl-J)
SO Shift Out (Ctrl-N), invokes the G1 (alternate) character set
SI Shift In (Ctrl-O), invokes the G0 (default) character set
SPC Space
TAB or HT Horizontal Tab (Ctrl-I)
VT Vertical Tab (Ctrl-K)

Escape Sequences

Sequence Function
ESC { ( | ) | * | + | $ } { 0 | A | B } Select ISO 2022 character sets.
  • ( sets the G0 character set
  • ) sets the G1 character set
  • * sets the G2 character set
  • + sets the G3 character set
  • $ sets the Kanji character set
  • 0 uses the DEC Special Character and Line Drawing set
  • A uses the United Kingdom (UK) character set
  • B uses the United States (USASCII) character set
ESC 7 Save cursor (SC)
ESC 8 Restore cursor (RC)
ESC = Application Keypad (SMKX)
ESC > Numeric Keypad (RMKX)
ESC @ Discards the subsequent character
ESC D Index (IND)
ESC E Next Line (NEL)
ESC G Graphics (an rxvt extension). Eterm replies to ESC G Q (query graphics) with ESC G 0 (no graphics available) and ignores all other graphics sequences.
ESC H Tab Set (HTS)
ESC M Reverse Index (RI)
ESC Z Obselete form of Send Device Attributes (DA), which is ESC [ c
ESC [ [ n ] @ Insert n blank Characters (ICH). Default for n is 1.
ESC [ [ n ] A Cursor Up n times (CUU), default 1
ESC [ [ n ] B Cursor Down n times (CUD), default 1
ESC [ [ n ] C Cursor Forward n times (CUF), default 1
ESC [ [ n ] D Cursor Backward n times (CUB), default 1
ESC [ [ n ] E Cursor Down n times and to first column, default 1
ESC [ [ n ] F Cursor Up n times and to first column, default 1
ESC [ [ n ] G Cursor to Column n (HPA)
ESC [ [ r ; c ] H Cursor Position [row;column] (CUP), default 1;1
ESC [ [ n ] I Move forward n tab stops, default 1
ESC [ [ n ] J Erase in Display (ED)
  • n == 0: Clear Below (default)
  • n == 1: Clear Above
  • n == 2: Clear All
ESC [ [ n ] K Erase in Line (EL)
  • n == 0: Clear to Right (default)
  • n == 1: Clear to Left (EL1)
  • n == 2: Clear All
ESC [ [ n ] L Insert n lines (IL), default 1
ESC [ [ n ] M Delete n lines (DL), default 1
ESC [ [ n ] P Delete n characters (DCH), default 1
ESC [ [ n ] W Tabulator functions
  • n == 0: Tab Set (HTS)
  • n == 2: Tab Clear (TBC), clear current column
  • n == 5: Tab Clear (TBC), clear all
ESC [ [ n ] X Erase n characters (ECH), default 1
ESC [ [ n ] Z Move backward n tabstops, default 1
ESC [ [ n ] ` Same as ESC [ n G (HPA)
ESC [ [ n ] a Same as ESC [ n C (CUF)
ESC [ [ n ] c Send Device Attributes (DA), default of 0 returns "ESC[?1;2c" indicating a VT100 with advanced video option
ESC [ [ n ] d Cursor to line n (VPA)
ESC [ [ n ] e Same as ESC [ n A (CUU)
ESC [ [ r ; c ] f Horizontal and Vertical Position (HVP), default 1;1
ESC [ [ n ] g Tab Clear
  • n == 0: Tab Clear (TBC), clear current column (default)
  • n == 3: Tab Clear (TBC), clear all
ESC [ [ n ] i Printing
  • n == 4: Disable transparent print mode (MC4)
  • n == 5: Enable transparent print mode (MC5)
ESC [ n [ ; n ... ] { h | l }
  • h: Set Mode (SM)
  • l: Reset Mode (RM)
  • n == 4: Insert Mode (SMIR)/Replace Mode (RMIR)
  • n == 20: Automatic Newline/Normal Linefeed (LNM)
ESC [ n [ ; n ... ] m Character Attributes (SGR)
  • n == 0: Normal (default)
  • n == 1/22: Turn bold (bright fg) on/off
  • n == 4/24: Turn underline on/off
  • n == 5/25: Turn "blink" (bright bg) on/off
  • n == 7/27: Turn inverse on/off
  • n == 30/40: foreground/background black
  • n == 31/41: foreground/background red
  • n == 32/42: foreground/background green
  • n == 33/43: foreground/background yellow
  • n == 34/44: foreground/background blue
  • n == 35/45: foreground/background magenta
  • n == 36/46: foreground/background cyan
  • n == 37/47: foreground/background white
  • n == 39/49: foreground/background default
ESC [ [ n ] n Device Status Report (DSR)
  • n == 5: Status Report, returns "ESC[0n" ("OK")
  • n == 6: Report Cursor Position (CPR) as "ESC[r;cR"
  • n == 7: Request display name (ignored by default for security reasons)
  • n == 8: Request version number in window title
  • n == 9: Display pixmap/transparency status in window title (See below.)
ESC [ [ t ; b ] r Set Scrolling Region (CSR), where t is the top row and b is the bottom row, defaults to the full screen
ESC [ ? n [ ; n ... ] { h | l | s | r | t } DEC Private Modes (shown as set/reset)
  • h: Set Private Mode (DECSET)
  • l: Reset Private Mode (DECRST)
  • s: Save all DEC Private Mode values
  • r: Restore previously-saved DEC Private Mode values
  • t: Toggle Private Mode (rxvt/Eterm extension)
  • n == 1: Application/Normal cursor keys (DECCKM)
  • n == 3: 132/80 column mode (DECCOLM)
  • n == 4: Smooth/Jump scrolling (DECSCLM) [not yet implemented]
  • n == 5: Reverse/Normal video (DECSCNM)
  • n == 6: Origin/Normal cursor mode (DECOM)
  • n == 7: Wraparound mode on/off (DECAWM)
  • n == 9: (X10 Xterm mouse reporting) Do/Don't send mouse coords on button press (see below)
  • n == 25: Visible/invisible cursor
  • n == 30: Toggle scrollbar on/off (rxvt/Eterm extension)
  • n == 35: Allow/Disallow xterm shift+key sequences (rxvt/Eterm extension)
  • n == 40: Allow/Disallow 80 <--> 132 mode
  • n == 47: Use Alternate/Normal screen buffer
  • n == 66: Application/Normal keypad (DECPAM)
  • n == 67: Backspace key sends BS/DEL (DECBKM)
  • n == 1000: (X11 Xterm mouse reporting) Do/Don't send mouse coords on button press and release (see below)
  • n == 1010: Scroll to bottom on tty output
  • n == 1012: Scroll to bottom on tty input
ESC [ n [ ; n [ ... ] ] t Window Operations
  • n == 1: Un-iconify window
  • n == 2: Iconify window
  • n == 3: Move window. Must by followed by ;x;y
  • n == 4: Resize window. Must by followed by ;height;width
  • n == 5: Raise window
  • n == 6: Lower window
  • n == 7: Refresh window
  • n == 8: Resize text area. Must by followed by ;height;width, with height and width given in characters.
  • n == 11: Report icon state. (not implemented)
  • n == 13: Report window position as ESC[3;x;yt
  • n == 14: Report window size in pixels as ESC[4;height;widtht
  • n == 18: Report text area size in characters as ESC[4;height;widtht
  • n == 20: Report icon name as ESC]LnameESC\
  • n == 21: Report window title as ESC]ltitleESC\
ESC ] n ; string BEL Set X Terminal Parameters
  • n == 0: Change icon name and window title to string
  • n == 1: Change icon name to string
  • n == 2: Change window title to string
  • n == 3: Set text property string (format: var=value)
  • n == 5: Steal input focus and raise window (See below.)
  • n == 6: Eterm-specific escape sequences (See below.)
  • n == 10: Set foreground color to string. If additional semicolon-delimited string values are specified, continue with n == 11.
  • n == 11: Set background color to string. If additional semicolon-delimited string values are specified, continue with n == 12.
  • n == 12: Set cursor color to string. If additional semicolon-delimited string values are specified, continue with n == 13.
  • n == 13: Set mouse pointer color to string. If additional semicolon-delimited string values are specified, continue with n == 14.
  • n == 14: Ignore string. If additional semicolon-delimited string values are specified, continue with n == 15.
  • n == 15: Ignore string. If additional semicolon-delimited string values are specified, continue with n == 16.
  • n == 16: Ignore string. If additional semicolon-delimited string values are specified, continue with n == 17.
  • n == 17: Ignore string. If additional semicolon-delimited string values are specified, continue with n == 18.
  • n == 18: Set bold color to string. Eterm extension (see below). If additional semicolon-delimited string values are specified, continue with n == 19.
  • n == 19: Set underline color to string. Eterm extension (see below).
  • n == 20: Image commands (see below)
  • n == 30: Dump contents of scrollback to file string. (Disabled by default.)
  • n == 39: Set the default foreground color to string
  • n == 49: Set the default background color to string
  • n == 50: Set font to string. rxvt/Eterm extensions:
    • string == "#+n": Change font up by n, default 1
    • string == "#-n": Change font down by n, default 1
    • string empty: Change to font 0
    • string == "#n": Change to font n
ESC ] { l | L | I } string ESC \
  • l: Change window title to string
  • L: Change icon name to string
  • I: Read new icon image from file whose path is string
ESC ] P n rr gg bb Changes terminal color n ('0' through 'f') to the color represented by the RGB values rr, gg, and bb. (Compatible with Linux console.)
ESC ] R Restores the original palette. (Compatible with Linux console.)
ESC c Full Reset (RIS)
ESC n Invoke the G2 character set (LS2)
ESC o Invoke the G3 character set (LS3)

Escape Codes Eterm Knows

Escaped String Meaning
Backslash-Escaped Characters (case is ignored)
\a BEL (Alert)
\b BS
\cX Interpreted as Ctrl-X. Analogous to ^X.
\e ESC
\f FF
\n LF
\r CR
\t TAB
\v VT
\nnn nnn is interpreted as an octal number, and the corresponding character is inserted.
Convenience Shortcuts
^X Interpreted as Ctrl-X. X can be any character between @ and _. Case is ignored.
C-X Interpreted as Ctrl-X. Analogous to ^X.
M-X Interpreted as ESC followed by X. Analogous to \eX. If the string begins with M-, a CR is automatically appended to the end of the string if not already present.

Image Escape Sequences

The string supplied to the image escape sequence (above) consists of a filename (which can be empty) followed by a semicolon, then one or more geometry strings. Each geometry string contains zero or one scale/position adjustment and may optionally be followed by a colon and one or more colon-delimited pixmap operations. The following table shows the valid geometry strings and their affects on the background image:

String Function
Adjusting scaling and position
WxH+X+Y Set scaling to W% by H%, and position to X% by Y%. W and H are percentages of the terminal window size. X and Y are also percentages; e.g., +50+50 centers the image in the window.
WxH+X Assumes Y == X
WxH Assumes Y == X == 50 (centers the image)
W+X+Y Assumes H == W
W+X Assumes H == W and Y == X
W Assumes H == W and Y == X == 50
Adjusting position only
=+X+Y Set position to X% by Y% (absolute).
=+X Set position to X% by X%.
+X+Y Adjust position horizontally X% and vertically Y% from current position (relative).
+X+X Adjust position horizontally X% and vertically X% from current position.
Adjusting scale only
Wx0 Multiply horizontal scaling factor by W%
0xH Multiply vertical scaling factor by H%
0x0 No scaling (show image at normal size).
Pixmap Operations
tile Tile image. Scaling/position modifiers above will affect the tile size and origin.
propscale When scaling, scale proportionally. That is, maintain the proper aspect ratio for the image. Any portion of the background not covered by the image is filled with the current background color.

Examples:

Mouse Reporting

When Eterm receives a mouse reporting request (and if mouse reporting is currently enabled), it replies with the sequence "ESC[Mbxy". The values for b, x, and y are as follows (subtract the value of space ' ' first):

Key Sequences

Cursor Keys
Key Pressed What Eterm Sends
Normal Shift Control Application
Up ESC [ A ESC [ a ESC O a ESC O A
Down ESC [ B ESC [ b ESC O b ESC O B
Right ESC [ C ESC [ c ESC O c ESC O C
Left ESC [ D ESC [ d ESC O d ESC O D
Special Keys
Key Pressed Normal Shift Control Control+Shift
Tab ^I ESC [ Z ^I  
Backspace ^H ^? ^?  
Home (Find) ESC [ 1 ~ ESC [ 1 $ ESC [ 1 ^ ESC [ 1 @
End (Select) ESC [ 4 ~ ESC [ 4 $ ESC [ 4 ^ ESC [ 4 @
Insert ESC [ 2 ~ Paste mouse selection ESC [ 2 ^ ESC [ 2 @
Delete (Execute) ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @
PageUp (Prior) ESC [ 5 ~ Scroll up one page ESC [ 5 ^ ESC [ 5 @
PageDown (Next) ESC [ 6 ~ Scroll down one page ESC [ 6 ^ ESC [ 6 @
Function Keys (Note: Shift-F1 through F10 sends F11-F20)
Key Pressed Normal Shift Control Control+Shift
F1 ESC [ 11 ~ ESC [ 23 ~ ESC [ 11 ^ ESC [ 23