foot-ctlseqs - Man Page

terminal control sequences supported by foot

Description

This document describes all the control sequences supported by foot.

  • Control characters
  • Sequences beginning with ESC
  • Csi - Control Sequence Introducer
     - SGR
     - Indexed and RGB colors (256-color palette and 24-bit colors)
     - Private modes
     - Window manipulation
     - Other
  • Osc - Operating System Command
  • DCS - Device Control String

Control characters

SequenceNameDescription
\aBELDepends on what bell in foot.ini(5) is set to.
\bBSBackspace; move the cursor left one step. Wrap if bw is enabled.
\tHTHorizontal tab; move the cursor to the next tab stop.
\nLFLine feed; move the cursor down one step, or scroll content up if at the bottom line.
\vVTVertical tab; identical to LF.
\fFFForm feed; identical to LF.
\rCRCarriage ret; move the cursor to the leftmost column.
\x0ESS0Shift out; select the G1 character set.
\x0FSS1Shift in; select the G0 character set.

Sequences beginning with ESC

Note: this table excludes sequences where ESC is part of a 7-bit equivalent to 8-bit C1 controls.

SequenceNameOriginDescription
\E 7DECSCVT100Save cursor position.
\E 8DECRCVT100Restore cursor position.
\E cRISVT100Reset terminal to initial state.
\E DINDVT100Line feed; move the cursor down one step, or scroll content up if at the bottom margin.
\E ENELVT100Next line; move the cursor down one step, and to the first column. Content is scrolled up if at the bottom line.
\E HHTSVT100Set one horizontal tab stop at the current position.
\E MRIVT100Reverse index; move the cursor up one step, or scroll content down if at the top margin.
\E NSS2VT220Single shift G2; select the G2 character set.
\E OSS3VT220Single shift G3; select the G3 character set.
\E =DECKPAMVT100Switch keypad to application mode.
\E >DECKPNMVT100Switch keypad to numeric mode.
\E ( CSCSVT100Designate G0 character set. Supported values for C are: 0 (DEC Special Character and Line Drawing Set), and B (USASCII).
\E ) CSCSVT100Designate G1 character set. Same supported values for C as in G0.
\E * CSCSVT220Designate G2 character set. Same supported values for C as in G0.
\E + CSCSVT220Designate G3 character set. Same supported values for C as in G0.

Csi

All sequences begin with \E[, sometimes abbreviated CSI. Spaces are used in the sequence strings to make them easier to read, but are not actually part of the string. I.e. \E[ 1 m is really \E[1m.

SGR

All SGR sequences are on the form \E[ <N> m, where N is a decimal number - the parameter. Multiple parameters can be combined in a single CSI sequence by separating them with semicolons: \E[ 1;2;3 m.

SequenceDescription
0Reset all attributes
1Bold
2Dim
3Italic
4Underline
5Blink
7Reverse video; swap foreground and background colors
8Conceal; text is not visible, but is copiable
9Crossed-out/strike
22Disable bold and dim
23Disable italic
24Disable underline
25Disable blink
27Disable reverse video
28Disable conceal
29Disable crossed-out
30-37Select foreground color (using regularN in foot.ini(5))
38See "indexed and RGB colors" below
39Use the default foreground color (foreground in foot.ini(5))
40-47Select background color (using regularN in foot.ini(5))
48See "indexed and RGB colors" below
49Use the default background color (background in foot.ini(5))
90-97Select foreground color (using brightN in foot.ini(5))
100-107Select background color (using brightN in foot.ini(5))

Indexed and RGB colors (256-color palette and 24-bit colors)

Foot supports both the new sub-parameter based variants, and the older parameter based variants for setting foreground and background colors.

Indexed colors:

  • \E[ 38:5:<idx> m
  • \E[ 38;5;<idx> m

RGB colors:

  • \E[ 38:2:<cs>:<r>:<g>:<b> m
  • \E[ 38:2:<r>:<g>:<b> m
  • \E[ 38;2;<r>;<g>;<b> m

The first variant is the "correct" one (and foot also recognizes, but ignores, the optional tolerance parameters).

The second one is allowed since many programs "forget" the color space ID, cs.

The sub-parameter based variants are preferred, and what foot's terminfo uses.

Private Modes

There are several Boolean-like "modes" that affect certain aspects of the terminal's behavior. These modes can be manipulated with the following 4 escape sequences:

SequenceNameDescription
\E[ ? Pm hDECSETEnable private mode
\E[ ? Pm lDECRSTDisable private mode
\E[ ? Pm sXTSAVESave private mode
\E[ ? Pm rXTRESTORERestore private mode

The Pm parameter in the above sequences denotes a numerical ID that corresponds to one of the following modes:

ParameterOriginDescription
1VT100Cursor keys mode (DECCKM)
5VT100Reverse video (DECSCNM)
6VT100Origin mode (DECOM)
7VT100Auto-wrap mode (DECAWM)
12AT&T 610Cursor blink
25VT220Cursor visibility (DECTCEM)
45xtermReverse-wraparound mode
47xtermSame as 1047 (see below)
1000xtermSend mouse x/y on button press/release
1001xtermUse hilite mouse tracking
1002xtermUse cell motion mouse tracking
1003xtermUse all motion mouse tracking
1004xtermSend FocusIn/FocusOut events
1006xtermSGR mouse mode
1007xtermAlternate scroll mode
1015urxvturxvt mouse mode
1034xterm8-bit Meta mode
1035xtermNum Lock modifier (see xterm numLock option)
1036xtermSend ESC when Meta modifies a key (see xterm metaSendsEscape option)
1042xtermPerform action for BEL character (see bell in foot.ini(5))
1047xtermUse alternate screen buffer
1048xtermSave/restore cursor (DECSET=save, DECRST=restore)
1049xtermEquivalent to 1048 and 1047 combined
1070xtermUse private color registers for each sixel
2004xtermWrap pasted text with start/end delimiters (bracketed paste mode)
8452xtermPosition cursor to the right of sixels, instead of on the next line
737769footInput Method Editor (IME) mode

Window manipulation

Foot implements a sub-set of XTerm's (originally dtterm's) window manipulation sequences. The generic format is:

\E[ Ps ; Ps ; Ps t

Parameter 1Parameter 2Description
11-Report if window is iconified. Foot always reports 1 - not iconified.
13-Report window position. Foot always reports (0,0), due to Wayland limitations.
132Report text area position. Foot always reports (0,0) due to Wayland limitations.
14-Report text area size, in pixels. Foot reports the grid size, excluding the margins.
142Report window size, in pixels. Foot reports the grid size plus the margins.
15-Report the screen size, in pixels.
16-Report the cell size, in pixels.
18-Report text area size, in characters.
19-Report screen size, in characters.
22-Push window title+icon. Foot does not support pushing the icon.
222Push window title.
23-Pop window title+icon. Foot does not support popping the icon.
232Pop window title.

Other

ParameterNameOriginDescription
\E[ Ps cDAVT100Send primary device attributes. Foot responds with "I'm a VT220 with sixel and ANSI color support".
\E[ Ps ACUUVT100Cursor up - move cursor up Ps times.
\E[ Ps BCUDVT100Cursor down - move cursor down Ps times.
\E[ Ps CCUFVT100Cursor forward - move cursor to the right Ps times.
\E[ Ps DCUBVT100Cursor backward - move cursor to the left Ps times.
\E[ Ps gTBCVT100Tab clear. Ps=0 -> clear current column. Ps=3 -> clear all.
\E[ Ps ; Ps fHVPVT100Horizontal and vertical position - move cursor to row ; column.
\E[ Ps ; Ps HCUPVT100Cursor position - move cursor to row ; column.
\E[ Ps JEDVT100Erase in display. Ps=0 -> below cursor. Ps=1 -> above
\E[ Ps KELVT100Erase in line. Ps=0 -> right of cursor. Ps=1 -> left of cursor. Ps=2 -> all.
\E[ Pm hSMVT100Set mode. Pm=4 -> enable IRM (insert mode). All other values of Pm are unsupported.
\E[ Pm lRMVT100Reset mode. Pm=4 -> disable IRM (insert mode). All other values of Pm are unsupported.
\E[ Ps nDSRVT100Device status report. Ps=5 -> device status. Ps=6 -> cursor position.
\E[ Ps LILVT220Insert Ps lines.
\E[ Ps MDLVT220Delete Ps lines.
\E[ Ps PDCHVT220Delete Ps characters.
\E[ Ps @ICHVT220Insert Ps blank characters.
\E[ Ps XECHVT220Erase Ps characters.
\E[ > cDA2VT220Send secondary device attributes. Foot responds with "I'm a VT220 and here's my version number".
\E[ ! pDECSTRVT220Soft terminal reset.
\E[ ? Ps $ pDECRQMVT320Request DEC private mode.
\E[ Ps TSDVT420Scroll down Ps lines.
\E[ sSCOSCSCO, VT510Save cursor position.
\E[ uSCORCSCO, VT510Restore cursor position.
\E[ Ps SP qDECSCUSRVT510Set cursor style. In foot, Ps=0 means "use style from foot.ini".
\E[ = Ps cDA3VT510send tertiary device attributes. Foot responds with "FOOT", in hexadecimal.
\E[ Pm dVPAECMA-48Line position absolute - move cursor to line Pm.
\E[ Pm eVPRECMA-48Line position relative - move cursor down Pm lines.
\E[ Pm aHPRECMA-48Character position relative - move cursor to the right Pm times.
\E[ Ps ECNLECMA-48Cursor next line - move the cursor down Ps times.
\E[ Ps FCPLECMA-48Cursor preceding line  - move the cursor up Ps times.
\E[ Pm `HPAECMA-48Character position absolute - move cursor to column Pm.
\E[ Ps GCHAECMA-48Cursor character absolute - move cursor to column Ps. cursor. Ps=2 -> all. Ps=3 -> saved lines.
\E[ Ps SSUECMA-48Scroll up Ps lines.
\E[ Ps ICHTECMA-48Cursor forward tabulation Ps tab stops.
\E[ Ps ZCBTECMA-48Cursor backward tabulation Ps tab stops.
\E[ Ps bREPECMA-48Repeat the preceding printable character Ps times.
\E[ ? Pi ; Pa ; Pv SXTSMGRAPHICSxtermSet or request sixel attributes.

Osc

All OSC sequences begin with \E], sometimes abbreviated OSC.

SequenceOriginDescription
\E] 0 ; Pt \E\ xtermSet window icon and title to Pt (foot does not support setting the icon)
\E] 2 ; Pt \E\ xtermSet window title to Pt
\E] 4 ; c ; spec \E\ xtermChange color number c to spec, where spec is a color in XParseColor format. foot only supports RGB colors; either rgb:<red>/<green>/<blue>, or the legacy format (#rgb).
\E] 7 ; Uri \E\ iTerm2Update the terminal's current working directory. Newly spawned terminals will launch in this directory. Uri must be on the format file://<hostname>/<path>. hostname must refer to your local host.
\E] 8 ; id=ID ; Uri \E\ VTE+iTerm2Hyperlink (a.k.a HTML-like anchors). id is optional; if assigned, all URIs with the same ID will be treated as a single hyperlink. An empty URI closes the hyperlink.
\E] 10 ; spec \E\ xtermChange the default foreground color to spec, a color in XParseColor format.
\E] 11 ; spec \E\ xtermChange the default background color to spec, a color in XParseColor format.
\E] 12 ; spec \E\ xtermChange cursor color to spec, a color in XParseColor format.
\E] 52 ; Pc ; ? \E\ xtermSend clipboard data. Pc can be either c, s or p. c uses the clipboard as source, and s and p uses the primary selection. The response is OSC 52 ; Pc ; <base64-encoded data>, where Pc indicates the source used.
\E] 52 ; Pc ; Pd \E\ xtermCopy Pd (base64 encoded text) to the clipboard. Pc indicates the target: c targets the clipboard and s and p the primary selection.
\E] 104 [; c] \E\ xtermReset color number c, or all colors (excluding the default foreground/background colors) if c is omitted.
\E] 110 \E\ xtermReset default foreground color
\E] 111 \E\ xtermReset default background color
\E] 112 \E\ xtermReset cursor color
\E] 555 \E\ footFlash the entire terminal (foot extension)
\E] 777;notify;title;msg \E\ urxvtDesktop notification, uses notify in foot.ini(5).

DCS

All DCS sequences begin with \EP (sometimes abbreviated DCS), and are terminated by \E\ (ST).

SequenceDescription
\EP q <sixel data> \E\ Emit a sixel image at the current cursor position
\EP = 1 s \E\ Begin application synchronized updates
\EP = 2 s \E\ End application synchronized updates

Footnote

Foot does not support 8-bit control characters ("CC1").

Info

2021-03-28