1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
foot-ctlseqs(5)
# DESCRIPTION
This document describes all the control sequences supported by foot.
- CC0 - 7-bit control sequences
- CC1 - 8-bit control sequences (*not supported*)
- CSI - Control Sequence Introducer
- OSC - Operating System Command
- DCS - Device Control String
# CC0 - 7-bit control sequences
[[ *Sequence*
:[ *Name*
:[ *Description*
| *\\a*
: BEL
: Depends on what *bell* in *foot.ini*(5) is set to.
| *\\b*
: BS
: Backspace; move the cursor left one step. Wrap if _bw_ is enabled.
| *\\t*
: HT
: Horizontal tab; move the cursor to the next tab stop.
| *\\n*
: LF
: Line feed; move the cursor down one step, or scroll content up if
at the bottom line.
| *\\v*
: VT
: Vertical tab; identical to _LF_.
| *\\f*
: FF
: Form feed; identical to _LF_.
| *\\r*
: CR
: Carriage ret; move the cursor to the leftmost column.
| *\\x0E*
: SS0
: Shift out; select the _G1_ character set.
| *\\x0F*
: SS1
: Shift in; select the _G0_ character set.
# CC1 - 8-bit control sequences
Foot does not support any CC1 control sequences.
# 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 *\\E1m*.
## 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*.
[[ *Sequence*
:[ *Description*
| 0
: Reset all attributes
| 1
: Bold
| 2
: Dim
| 3
: Italic
| 4
: Underline
| 5
: Blink
| 7
: Reverse video; swap foreground and background colors
| 8
: Conceal; text is not visible, but is copiable
| 9
: Crossed-out/strike
| 22
: Disable *bold* and *dim*
| 23
: Disable italic
| 24
: Disable underline
| 25
: Disable blink
| 27
: Disable reverse video
| 28
: Disable conceal
| 29
: Disable crossed-out
| 30-37
: Select foreground color (using *regularN* in *foot.ini*(5))
| 38
: See "indexed and RGB colors" below
| 39
: Use the default foreground color (*foreground* in *foot.ini*(5))
| 40-47
: Select background color (using *regularN* in *foot.ini*(5))
| 48
: See "indexed and RGB colors" below
| 49
: Use the default background color (*background* in *foot.ini*(5))
| 90-97
: Select foreground color (using *brightN* in *foot.ini*(5))
| 100-107
: Select 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:
[[ *Sequence*
:[ *Name*
:[ *Description*
| \\E[ ? _Pm_ *h*
: DECSET
: Enable private mode
| \\E[ ? _Pm_ *l*
: DECRST
: Disable private mode
| \\E[ ? _Pm_ *s*
: XTSAVE
: Save private mode
| \\E[ ? _Pm_ *r*
: XTRESTORE
: Restore private mode
The _Pm_ parameter in the above sequences denotes a numerical ID
that corresponds to one of the following modes:
[[ *Parameter*
:[ *Origin*
:[ *Description*
| 1
: VT100
: Cursor keys mode (DECCKM)
| 5
: VT100
: Reverse video (DECSCNM)
| 6
: VT100
: Origin mode (DECOM)
| 7
: VT100
: Auto-wrap mode (DECAWM)
| 12
: AT&T 610
: Cursor blink
| 25
: VT220
: Cursor visibility (DECTCEM)
| 45
: xterm
: Reverse-wraparound mode
| 47
: xterm
: Same as 1047 (see below)
| 1000
: xterm
: Send mouse x/y on button press/release
| 1001
: xterm
: Use hilite mouse tracking
| 1002
: xterm
: Use cell motion mouse tracking
| 1003
: xterm
: Use all motion mouse tracking
| 1004
: xterm
: Send FocusIn/FocusOut events
| 1006
: xterm
: SGR mouse mode
| 1007
: xterm
: Alternate scroll mode
| 1015
: urxvt
: urxvt mouse mode
| 1034
: xterm
: 8-bit Meta mode
| 1035
: xterm
: Num Lock modifier (see xterm numLock option)
| 1036
: xterm
: Send ESC when Meta modifies a key (see xterm metaSendsEscape option)
| 1042
: xterm
: Perform action for BEL character (see *bell* in *foot.ini*(5))
| 1047
: xterm
: Use alternate screen buffer
| 1048
: xterm
: Save/restore cursor (DECSET=save, DECRST=restore)
| 1049
: xterm
: Equivalent to 1048 and 1047 combined
| 2004
: xterm
: Wrap pasted text with start/end delimiters (bracketed paste mode)
| 737769
: foot
: Input Method Editor (IME) mode
## Other
*TODO*: all other CSI sequences that does not fall into any of the
above categories.
# OSC
All _OSC_ sequences begin with *\\E]*, sometimes abbreviated _OSC_.
[[ *Sequence*
:[ *Description*
| \\E] 0 ; _Pt_ ST
: Set window icon and title to _Pt_ (foot does not support setting the
icon)
| \\E] 2 ; _Pt_ ST
: Set window title to _Pt_
| \\E] 4 ; _c_ ; _spec_ ST
: Change 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_ ST
: Update 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] 10 ; _spec_ ST
: Change the default foreground color to _spec_, a color in
*XParseColor* format.
| \\E] 11 ; _spec_ ST
: Change the default background color to _spec_, a color in
*XParseColor* format.
| \\E] 12 ; _spec_ ST
: Change cursor color to _spec_, a color in *XParseColor* format.
| \\E] 52 ; _Pc_ ; ? ST
: Send 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_ ST
: Copy _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_] ST
: Reset color number _c_, or all colors (excluding the default
foreground/background colors) if _c_ is omitted.
| \\E] 110 ST
: Reset default foreground color
| \\E] 111 ST
: Reset default background color
| \\E] 112 ST
: Reset cursor color
| \\E] 555 ST
: Flash the entire terminal (foot extension)
| \\E] 777 ; notify ; _summary_ ; _message_ ST
: Desktop notification, uses *notify* in *foot.ini*(5).
# DCS
All _DCS_ sequences begin with *\\EP* (from here denoted _DCS_), and
are terminated by *\\E\\* (ST).
[[ *Sequence*
:[ *Description*
| \\EP q <sixel data> ST
: Emit a sixel image at the current cursor position
| \\EP = 1 s ST
: Begin application synchronized updates
| \\EP = 2 s ST
: End application synchronized updates
|