foot-ctlseqs - Man Page

terminal control sequences supported by foot

Description

This document describes all the control sequences supported by foot.

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.
\x0ESOShift out; select the G1 character set.
\x0FSIShift 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 select of G2 character set (affects next character only).
\E OSS3VT220Single shift select of G3 character set (affects next character only).
\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 in 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.

ParameterDescription
0Reset all attributes
1Bold
2Dim
3Italic
4Underline, including styled underlines
5Blink
7Reverse video; swap foreground and background colors
8Conceal; text is not visible, but is copiable
9Crossed-out/strike
21Double underline
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))
38Select foreground color, see "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))
48Select background color, see "indexed and RGB colors" below
49Use the default background color (background in foot.ini(5))
58Select underline color, see "indexed and RGB colors" below
59Use the default underline color
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 are what foot's terminfo(5) entry 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)
66VT320Numeric keypad mode (DECNKM); same as DECKPAM/DECKPNM when enabled/disabled
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
1016xtermSGR-Pixels 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)
2026terminal-wgApplication synchronized updates mode
2027contourGrapheme cluster processing
2048TODOIn-band window resize notifications
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.
20-Report icon label.
21-Report window title.
22-Push window title+icon.
221Push window icon.
222Push window title.
23-Pop window title+icon.
231Pop window 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 (Insertion Replacement Mode). All other values of Pm are unsupported.
\E[ Pm lRMVT100Reset mode. Pm=4 -> disable IRM (Insertion Replacement 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 status of DEC private mode. The Ps parameter corresponds to one of the values mentioned in the "Private Modes" section above (as set with DECSET/DECRST).
\E[ Ps $ pDECRQMVT320Request status of ECMA-48/ANSI mode. See the descriptions for SM/RM above for recognized Ps values.
\E[ Pt ; Pl ; Pb ; Pr ; Pm $ rDECCARAVT400Change attributes in rectangular area. Pt, Pl, Pb and Pr denotes the rectangle, Pm denotes the SGR attributes.
\E[ Pt ; Pl ; Pb ; Pr ; Pm $ tDECRARAVT400Invert attributes in rectangular area. Pt, Pl, Pb and Pr denotes the rectangle, Pm denotes the SGR attributes.
\E[ Pt ; Pl ; Pb ; Pr ; Pp ; Pt ; Pl ; Pp $ vDECCRAVT400Copy rectangular area.  Pt, Pl, Pb and Pr denotes the rectangle, Pt and Pl denotes the target location.
\E[ Pc ; Pt ; Pl ; Pb ; Pr $ xDECFRAVT420Fill rectangular area. Pc is the character to use, Pt, Pl, Pb and Pr denotes the rectangle.
\E[ Pt ; Pl ; Pb ; Pr $ zDECERAVT400Erase rectangular area. Pt, Pl, Pb and Pr denotes the rectangle.
\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.
\E[ > Ps qXTVERSIONxtermPs=0 -> report terminal name and version, in the form \EP>|foot(version)\E\.
\E[ > 4 ; Pv mXTMODKEYSxtermSet level of the modifyOtherKeys property to Pv. Note that foot only supports level 1 and 2, where level 1 is the default setting.
\E[ ? Pp mXTQMODKEYSxtermQuery key modifier options
\E[ > 4 n<unnamed>xtermResets the modifyOtherKeys property to level 1. Note that in foot, this sequence does not completely disable modifyOtherKeys, since foot only supports level 1 and level 2 (and not level 0).
\E[ ? u<unnamed>kittyQuery current values of the Kitty keyboard flags.
\E[ > flags u<unnamed>kittyPush a new entry, flags, to the Kitty keyboard stack.
\E[ < number u<unnamed>kittyPop number of entries from the Kitty keyboard stack.
\E[ = flags ; mode u<unnamed>kittyUpdate current Kitty keyboard flags, according to mode.
\E[ # PXTPUSHCOLORSxtermPush current color palette onto stack
\E[ # QXTPOPCOLORSxtermPop color palette from stack
\E[ # RXTREPORTCOLORSxtermReport the current entry on the palette stack, and the number of palettes stored on the stack.

Osc

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

SequenceOriginDescription
\E] 0 ; Pt \E\ xtermSet window icon and title to Pt.
\E] 1 ; Pt \E\ xtermSet window icon to Pt.
\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 in 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=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] 9 ; msg \E\ iTerm2Desktop notification, uses notify in foot.ini(5).
\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. Foot implements URxvt's transparency extension; e.g. spec=[75]#ff00ff or spec=rgba:ff/00/ff/bf (pink with 75% alpha).
\E] 12 ; spec \E\ xtermChange cursor color to spec, a color in XParseColor format.
\E] 17 ; spec \E\ xtermChange selection background color to spec, a color in XParseColor format.
\E] 19 ; spec \E\ xtermChange selection foreground color to spec, a color in XParseColor format.
\E] 22 ; xcursor-pointer-name \E\ xtermSets the xcursor pointer. An empty name, or an invalid name resets it.
\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 \E] 52 ; Pc ; <base64-encoded data> E\, where Pc denotes the source used.
\E] 52 ; Pc ; Pd \E\ xtermCopy Pd (base64 encoded text) to the clipboard. Pc denotes the target: c targets the clipboard and s and p the primary selection.
\E] 99 ; params ; payload \E\kittyDesktop notification; uses desktop-notifications.command in foot.ini(5).
\E] 104 ; c \E\ xtermReset color number c (multiple semicolon separated c values may be provided), 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] 117 \E\ xtermReset selection background color
\E] 119 \E\ xtermReset selection foreground color
\E] 133 ; A \E\ FinalTermMark start of shell prompt
\E] 133 ; C \E\ FinalTermMark start of command output
\E] 133 ; D \E\ FinalTermMark end of command output
\E] 176 ; app-id \E\ footSet app ID. app-id is optional; if assigned, the terminal window App ID will be set to the value. An empty App ID resets the value to the default.
\E] 555 \E\ footFlash the entire terminal (foot extension)
\E] 777;notify;title;msg \E\ urxvtDesktop notification, uses desktop-notifications.command 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 $ q <query> \E\ Request selection or setting (DECRQSS). Implemented queries: DECSTBM, SGR and DECSCUSR.
\EP = C s \E\ Begin (C=1) or end (C=2) application synchronized updates. This sequence is supported for compatibility reasons, but it's recommended to use private mode 2026 (see above) instead.
\EP + q <hex encoded capability name> \E\ Query builtin terminfo database (XTGETTCAP)

Footnote

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

Info

2024-10-24