ttx 0.1.0
Loading...
Searching...
No Matches
capabilities.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace ttx::terminal {
6constexpr auto ttx_names = di::Array {
7 "xterm-ttx"_tsv,
8 "ttx"_tsv,
9 "ttx terminal multiplexer"_tsv,
10};
11
12// These capabilities are sourced from different places, including:
13// terminfo man page: https://manned.org/man/arch/terminfo.5
14// user_caps man page: https://manned.org/man/arch/user_caps.5
15// tmux man page (TERMINFO extensions): https://manned.org/man/arch/user_caps.5
16// and checked against ghostty and kitty's terminfo via `infocmp -x`
17//
18// The list is sorted alphabetically (mostly) after grouping by value type. This matches the output
19// of `infocmp -x` so we can easily compare this list of the output.
20constexpr auto ttx_capabilities = di::Array {
22 .long_name = "Automatic right margin"_sv,
23 .short_name = "am"_tsv,
24 .description = "Automatic margins (autowrap enabled by default)"_sv,
25 },
27 .long_name = "Background character erase"_sv,
28 .short_name = "bce"_tsv,
29 .description = "Clearing the screens sets the background color, instead of resetting the cell fully"_sv,
30 },
32 .long_name = "Modifiable palette"_sv,
33 .short_name = "ccc"_tsv,
34 .description = "Terminal allows modifying the color palette dynamically"_sv,
35 // TODO: enable after support this xterm escape (and the kitty version)
36 // https://sw.kovidgoyal.net/kitty/color-stack/
37 .enabled = false,
38 },
40 .long_name = "Has status line"_sv,
41 .short_name = "hs"_tsv,
42 .description = "Has status line (for displaying window title)"_sv,
43 .enabled = false, // TODO: enable after implementing OSC 1 (set window title)
44 },
46 .long_name = "Has meta key"_sv,
47 .short_name = "km"_tsv,
48 .description = "Keyboard reports include meta key bit on modifiers"_sv,
49 },
51 .long_name = "No built-in echo"_sv,
52 .short_name = "mc5i"_tsv,
53 .description = "Terminal won't echo (presumably key presses) automatically"_sv,
54 },
56 .long_name = "Move in insert mode"_sv,
57 .short_name = "mir"_tsv,
58 .description = "Cursor can move in insert mode"_sv,
59 },
61 .long_name = "Move in standout mode"_sv,
62 .short_name = "msgr"_tsv,
63 .description = "Cursor can move in standout mode (apparently standout mode is inverse (SGR 7))"_sv,
64 },
66 .long_name = "No pad character"_sv,
67 .short_name = "npc"_tsv,
68 .description = "? What is a pad character"_sv,
69 },
71 .long_name = "Newline ignored after 80 cols"_sv,
72 .short_name = "xenl"_tsv,
73 .description = "? - This is set by xterm"_sv,
74 },
76 .long_name = "Default colors"_sv,
77 .short_name = "AX"_tsv,
78 .description = "Supports resetting the foreground/background via SGR 39/49"_sv,
79 },
81 .long_name = "Colored underlines"_sv,
82 .short_name = "Su"_tsv,
83 .description = "Supports changing underline color via SGR 58-59"_sv,
84 },
86 .long_name = "Truecolor"_sv,
87 .short_name = "Tc"_tsv,
88 .description = "Supports 24 bit true color via SGR 38/38"_sv,
89 },
91 .long_name = "Xterm extnesions"_sv,
92 .short_name = "XT"_tsv,
93 .description = "Supports various xterm extensions (tmux uses this to set some default capabilities)"_sv,
94 },
96 .long_name = "Kitty keyboard protocol"_sv,
97 .short_name = "fullkbd"_tsv,
98 .description = "Supports kitty keyboard protocol"_sv,
99 },
100 Capability {
101 .long_name = "Maximum colors"_sv,
102 .short_name = "colors"_tsv,
103 .value = 256u,
104 .description = "Number of colors in the palette"_sv,
105 },
106 Capability {
107 .long_name = "Columns"_sv,
108 .short_name = "cols"_tsv,
109 .value = 80u,
110 .description = "Number of columns on screen (this is dynamic)"_sv,
111 },
112 Capability {
113 .long_name = "Initial tab spacing"_sv,
114 .short_name = "it"_tsv,
115 .value = 8u,
116 .description = "Default spacing used for tab characters"_sv,
117 },
118 Capability {
119 .long_name = "Lines"_sv,
120 .short_name = "lines"_tsv,
121 .value = 24u,
122 .description = "Number of lines (rows) on screen (this is dynamic)"_sv,
123 },
124 Capability {
125 .long_name = "Maximum color pairs"_sv,
126 .short_name = "pairs"_tsv,
127 .value = 0x7fffu, // We use a 16-bit style id internally
128 .description = "Number of different graphics renditions which can co-exist on the screen"_sv,
129 },
130 Capability {
131 .long_name = "UTF-8 always"_sv,
132 .short_name = "U8"_tsv,
133 // TODO: remove this capability after supporting box drawing characters
134 .value = 1u,
135 .description = "Disable box drawing characters by saying we only support UTF-8"_sv,
136 },
137 Capability {
138 .long_name = "Alternate charset pairs"_sv,
139 .short_name = "acsc"_tsv,
140 .value = "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"_tsv, // Magic copied from xterm's terminfo
141 .description = "Alternate charset mapping (this is the identity)"_sv,
142 },
143 Capability {
144 .long_name = "Bell"_sv,
145 .short_name = "bel"_tsv,
146 .value = "^G"_tsv,
147 .description = "Bell character - \\a"_sv,
148 },
149 Capability {
150 .long_name = "Blink"_sv,
151 .short_name = "blink"_tsv,
152 .value = "\\E[5m"_tsv,
153 .description = "Set blinking cell via SGR 5"_sv,
154 },
155 Capability {
156 .long_name = "Bold"_sv,
157 .short_name = "bold"_tsv,
158 .value = "\\E[1m"_tsv,
159 .description = "Set bold cell via SGR 1"_sv,
160 },
161 Capability {
162 .long_name = "Shift tab"_sv,
163 .short_name = "cbt"_tsv,
164 .value = "\\E[Z"_tsv,
165 .description = "Terminal sends CSI Z on shift+tab"_sv,
166 },
167 Capability {
168 .long_name = "Invisible cursor"_sv,
169 .short_name = "civis"_tsv,
170 .value = "\\E[?25l"_tsv,
171 .description = "Hide the cursor via CSI ? 25 l"_sv,
172 },
173 Capability {
174 .long_name = "Clear"_sv,
175 .short_name = "clear"_tsv,
176 .value = "\\E[H\\E[2J"_tsv,
177 .description = "Clear the scren by sending CSI H (cursor to 0,0) and CSI 2 J (clear full screen)"_sv,
178 },
179 Capability {
180 .long_name = "Cursor Normal"_sv,
181 .short_name = "cnorm"_tsv,
182 // We currently don't support mode 12 to control the cursor blinking, but
183 // there's no harm in adding it now.
184 .value = "\\E[?12h\\E[?25h"_tsv,
185 .description = "Reset the cursor by enabling blinking (CSI ? 12 h) and showing the cursor (CSI ? 25 h)"_sv,
186 },
187 Capability {
188 .long_name = "Carriage return"_sv,
189 .short_name = "cr"_tsv,
190 .value = "\\r"_tsv,
191 .description = "Terminal recognizes \\r as carrigate return"_sv,
192 },
193 Capability {
194 .long_name = "Change scroll region"_sv,
195 .short_name = "csr"_tsv,
196 .value = "\\E[%i%p1%d;%p2%dr"_tsv, // Copied from ghostty/kitty
197 .description = "Set vertical scroll region via CSI b; t r"_sv,
198 },
199 Capability {
200 .long_name = "Paramaterized cursor back"_sv,
201 .short_name = "cub"_tsv,
202 .value = "\\E[%p1%dD"_tsv, // Copied from ghostty/kitty
203 .description = "Move cursor left via CSI Ps D"_sv,
204 },
205 Capability {
206 .long_name = "Cursor back"_sv,
207 .short_name = "cub1"_tsv,
208 .value = "^H"_tsv,
209 .description = "Move cursor left 1 via \\b (^H)"_sv,
210 },
211 Capability {
212 .long_name = "Paramaterized cursor down"_sv,
213 .short_name = "cud"_tsv,
214 .value = "\\E[%p1%dB"_tsv,
215 .description = "Move cursor down via CSI Ps B"_sv,
216 },
217 Capability {
218 .long_name = "Cursor down"_sv,
219 .short_name = "cud1"_tsv,
220 .value = "\\n"_tsv,
221 .description = "Move cursor down 1 via \\n"_sv,
222 },
223 Capability {
224 .long_name = "Paramaterized cursor right"_sv,
225 .short_name = "cuf"_tsv,
226 .value = "\\E[%p1%dC"_tsv,
227 .description = "Move cursor right via CSI Ps C"_sv,
228 },
229 Capability {
230 .long_name = "Cursor right"_sv,
231 .short_name = "cuf1"_tsv,
232 .value = "\\E[C"_tsv,
233 .description = "Move cursor right 1 via CSI C"_sv,
234 },
235 Capability {
236 .long_name = "Cursor address"_sv,
237 .short_name = "cup"_tsv,
238 .value = "\\E[%i%p1%d;%p2%dH"_tsv, // Copied from ghostty/kitty
239 .description = "Move cursor to r,c via CSI r; c H"_sv,
240 },
241 Capability {
242 .long_name = "Paramaterized cursor up"_sv,
243 .short_name = "cuu"_tsv,
244 .value = "\\E[%p1%dA"_tsv,
245 .description = "Move cursor up via CSI Ps A"_sv,
246 },
247 Capability {
248 .long_name = "Cursor up"_sv,
249 .short_name = "cuu1"_tsv,
250 .value = "\\E[A"_tsv,
251 .description = "Move cursor up 1 via CSI A"_sv,
252 },
253 Capability {
254 .long_name = "Cursor visible"_sv,
255 .short_name = "cvvis"_tsv,
256 // This is the same as cnorm except in a single CSI sequence.
257 .value = "\\E[?12;25h"_tsv, // copied from ghostty/kitty
258 .description = "Make cursor visible via CSI ? 12 ; 25 h"_sv,
259 },
260 Capability {
261 .long_name = "Delete characters"_sv,
262 .short_name = "dch"_tsv,
263 .value = "\\E[%p1%dP"_tsv,
264 .description = "Delete characters via CSI Ps P"_sv,
265 },
266 Capability {
267 .long_name = "Delete character"_sv,
268 .short_name = "dch1"_tsv,
269 .value = "\\E[P"_tsv,
270 .description = "Delete character via CSI P"_sv,
271 },
272 Capability {
273 .long_name = "Dim"_sv,
274 .short_name = "dim"_tsv,
275 .value = "\\E[2m"_tsv,
276 .description = "Dim the cell via SGR 2"_sv,
277 },
278 Capability {
279 .long_name = "Delete lines"_sv,
280 .short_name = "dl"_tsv,
281 .value = "\\E[%p1%dM"_tsv,
282 .description = "Delete lines via CSI Ps M"_sv,
283 },
284 Capability {
285 .long_name = "Delete line"_sv,
286 .short_name = "dl1"_tsv,
287 .value = "\\E[M"_tsv,
288 .description = "Delete line via CSI M"_sv,
289 },
290 Capability {
291 .long_name = "Disable status line"_sv,
292 .short_name = "dsl"_tsv,
293 .value = R"(\E]2;\E\\)"_tsv,
294 .description = "Disable window title via blank OSC 2"_sv,
295 // TODO: enable once we support OSC 1/2
296 .enabled = false,
297 },
298 Capability {
299 .long_name = "Erase characters"_sv,
300 .short_name = "ech"_tsv,
301 .value = "\\E[%p1%dX"_tsv,
302 .description = "Erase characters via CSI Ps X"_sv,
303 },
304 Capability {
305 .long_name = "Erase display"_sv,
306 .short_name = "ed"_tsv,
307 .value = "\\E[J"_tsv,
308 .description = "Erase to screen end via CSI J"_sv,
309 },
310 Capability {
311 .long_name = "Erase line"_sv,
312 .short_name = "el"_tsv,
313 .value = "\\E[K"_tsv,
314 .description = "Erase to line end via CSI K"_sv,
315 },
316 Capability {
317 .long_name = "Erase line beginning"_sv,
318 .short_name = "el1"_tsv,
319 .value = "\\E[1K"_tsv,
320 .description = "Erase to beginning of line end via CSI 1 K"_sv,
321 },
322 Capability {
323 .long_name = "Flash"_sv,
324 .short_name = "flash"_tsv,
325 .value = "\\E[?5h$<100/>\\E[?5l"_tsv, // Copied from ghostty/kitty
326 .description = "Flash screen via enabling/disabling video reverse mode (CSI ? 5 h/l), after 100 ms"_sv,
327 },
328 Capability {
329 .long_name = "From status line"_sv,
330 .short_name = "fsl"_tsv,
331 .value = "^G"_tsv,
332 .description = "Terminate OSC sequence via \\a (^G)"_sv,
333 // TODO: enable after supporting OSC 2
334 .enabled = false,
335 },
336 Capability {
337 .long_name = "Home"_sv,
338 .short_name = "home"_tsv,
339 .value = "\\E[H"_tsv,
340 .description = "Move cursor to home via CSI H"_sv,
341 },
342 Capability {
343 .long_name = "Horizontal position absolute"_sv,
344 .short_name = "hpa"_tsv,
345 .value = "\\E[%i%p1%dG"_tsv,
346 .description = "Set cursor col to n via CSI n G"_sv,
347 },
348 Capability {
349 .long_name = "Horizontal tab"_sv,
350 .short_name = "ht"_tsv,
351 .value = "^I"_tsv,
352 .description = "Terminal recognizes tab as \\t (^I)"_sv,
353 },
354 Capability {
355 .long_name = "Horizontal tab set"_sv,
356 .short_name = "hts"_tsv,
357 .value = "\\EH"_tsv,
358 .description = "Set horizontal tab via CI HTS (ESC H)"_sv,
359 },
360 Capability {
361 .long_name = "Insert characters"_sv,
362 .short_name = "ich"_tsv,
363 .value = "\\E[%p1%d@"_tsv,
364 .description = "Insert characters via CSI Ps @"_sv,
365 },
366 Capability {
367 .long_name = "Insert character"_sv,
368 .short_name = "ich1"_tsv,
369 .value = "\\E[@"_tsv,
370 .description = "Insert character via CSI @"_sv,
371 },
372 Capability {
373 .long_name = "Insert lines"_sv,
374 .short_name = "il"_tsv,
375 .value = "\\E[%p1%dL"_tsv,
376 .description = "Insert lines via CSI Ps L"_sv,
377 },
378 Capability {
379 .long_name = "Insert line"_sv,
380 .short_name = "il1"_tsv,
381 .value = "\\E[L"_tsv,
382 .description = "Insert line via CSI L"_sv,
383 },
384 Capability {
385 .long_name = "Index"_sv,
386 .short_name = "ind"_tsv,
387 .value = "\\n"_tsv,
388 .description = "Scroll text down via \\n (we auto-scroll when moving the cursor down via \\n)"_sv,
389 },
390 Capability {
391 .long_name = "Scroll up"_sv,
392 .short_name = "indn"_tsv,
393 .value = "\\E[%p1%dS"_tsv,
394 .description = "Scroll up via CSI Ps S"_sv,
395 },
396 Capability {
397 .long_name = "Initialize color"_sv,
398 .short_name = "initc"_tsv,
399 .value =
400 R"(\E]4;%p1%d;rgb:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\)"_tsv,
401 .description = "Initialize color value via OSC 4"_sv,
402 // TODO: enable once we support setting color palette via OSC 4
403 .enabled = false,
404 },
405 Capability {
406 .long_name = "Invisible"_sv,
407 .short_name = "invis"_tsv,
408 .value = "\\E[8m"_tsv,
409 .description = "Make cell invisible via CSI 8"_sv,
410 },
411
412// Key board related capabiltiies. It would be good to have this in sync with our parser/generator.
413#define KEY_CAP(short, v, name) \
414 Capability { \
415 .long_name = name ""_sv, \
416 .short_name = short ""_tsv, \
417 .value = v ""_tsv, \
418 .description = "Escape terminal sends when " #name " is pressed"_sv, \
419 },
420
421#define KEYS(M) \
422 M("kBEG", "\\E[1;2E", "Shift+Begin") \
423 M("kDC", "\\E[3;2~", "Shift+Delete") \
424 M("kEND", "\\E[1;2F", "Shift+End") \
425 M("kHOM", "\\E[1;2H", "Shift+Home") \
426 M("kIC", "\\E[2;2~", "Shift+Insert") \
427 M("kLFT", "\\E[1;2D", "Shift+Left") \
428 M("kNXT", "\\E[6;2~", "Shift+PageDown") \
429 M("kPRV", "\\E[5;2~", "Shift+PageUp") \
430 M("kRIT", "\\E[1;2C", "Shift+Right") \
431 M("kbeg", "\\EOE", "Begin") \
432 M("kbs", "^?", "Backspace") \
433 M("kcbt", "\\E[Z", "Shift+Tab") \
434 M("kcub1", "\\EOD", "Left") \
435 M("kcud1", "\\EOB", "Down") \
436 M("kcuf1", "\\EOC", "Right") \
437 M("kcuu1", "\\EOA", "Up") \
438 M("kdch1", "\\E[3~", "Delete") \
439 M("kend", "\\EOF", "End") \
440 M("kf1", "\\EOP", "F1") \
441 M("kf10", "\\E[21~", "F10") \
442 M("kf11", "\\E[23~", "F11") \
443 M("kf12", "\\E[24~", "F12") \
444 M("kf13", "\\E[1;2P", "Shift+F1") \
445 M("kf14", "\\E[1;2Q", "Shift+F2") \
446 M("kf15", "\\E[1;2R", "Shift+F3") \
447 M("kf16", "\\E[1;2S", "Shift+F4") \
448 M("kf17", "\\E[15;2~", "Shift+F5") \
449 M("kf18", "\\E[17;2~", "Shift+F6") \
450 M("kf19", "\\E[18;2~", "Shift+F7") \
451 M("kf2", "\\EOQ", "F2") \
452 M("kf20", "\\E[19;2~", "Shift+F8") \
453 M("kf21", "\\E[20;2~", "Shift+F9") \
454 M("kf22", "\\E[21;2~", "Shift+F10") \
455 M("kf23", "\\E[23;2~", "Shift+F11") \
456 M("kf24", "\\E[24;2~", "Shift+F12") \
457 M("kf25", "\\E[1;5P", "Control+F1") \
458 M("kf26", "\\E[1;5Q", "Control+F2") \
459 M("kf27", "\\E[1;5R", "Control+F3") \
460 M("kf28", "\\E[1;5S", "Control+F4") \
461 M("kf29", "\\E[15;5~", "Control+F5") \
462 M("kf3", "\\EOR", "F3") \
463 M("kf30", "\\E[17;5~", "Control+F6") \
464 M("kf31", "\\E[18;5~", "Control+F7") \
465 M("kf32", "\\E[19;5~", "Control+F8") \
466 M("kf33", "\\E[20;5~", "Control+F9") \
467 M("kf34", "\\E[21;5~", "Control+F10") \
468 M("kf35", "\\E[23;5~", "Control+F11") \
469 M("kf36", "\\E[24;5~", "Control+F12") \
470 M("kf37", "\\E[1;6P", "Control+Shift+F1") \
471 M("kf38", "\\E[1;6Q", "Control+Shift+F2") \
472 M("kf39", "\\E[1;6R", "Control+Shift+F3") \
473 M("kf4", "\\EOS", "F4") \
474 M("kf40", "\\E[1;6S", "Control+Shift+F4") \
475 M("kf41", "\\E[15;6~", "Control+Shift+F5") \
476 M("kf42", "\\E[17;6~", "Control+Shift+F6") \
477 M("kf43", "\\E[18;6~", "Control+Shift+F7") \
478 M("kf44", "\\E[19;6~", "Control+Shift+F8") \
479 M("kf45", "\\E[20;6~", "Control+Shift+F9") \
480 M("kf46", "\\E[21;6~", "Control+Shift+F10") \
481 M("kf47", "\\E[23;6~", "Control+Shift+F11") \
482 M("kf48", "\\E[24;6~", "Control+Shift+F12") \
483 M("kf49", "\\E[1;3P", "Alt+F1") \
484 M("kf5", "\\E[15~", "F5") \
485 M("kf50", "\\E[1;3Q", "Alt+F2") \
486 M("kf51", "\\E[1;3R", "Alt+F3") \
487 M("kf52", "\\E[1;3S", "Alt+F4") \
488 M("kf53", "\\E[15;3~", "Alt+F5") \
489 M("kf54", "\\E[17;3~", "Alt+F6") \
490 M("kf55", "\\E[18;3~", "Alt+F7") \
491 M("kf56", "\\E[19;3~", "Alt+F8") \
492 M("kf57", "\\E[20;3~", "Alt+F9") \
493 M("kf58", "\\E[21;3~", "Alt+F10") \
494 M("kf59", "\\E[23;3~", "Alt+F11") \
495 M("kf6", "\\E[17~", "F6") \
496 M("kf60", "\\E[24;3~", "Alt+F12") \
497 M("kf61", "\\E[1;4P", "Alt+Shift+F1") \
498 M("kf62", "\\E[1;4Q", "Alt+Shift+F2") \
499 M("kf63", "\\E[1;4R", "Alt+Shift+F3") \
500 M("kf64", "\\E[1;4S", "Alt+Shift+F4") \
501 M("kf7", "\\E[18~", "F7") \
502 M("kf8", "\\E[19~", "F8") \
503 M("kf9", "\\E[20~", "F9") \
504 M("khome", "\\EOH", "Home") \
505 M("kich1", "\\E[2~", "Insert") \
506 M("kind", "\\E[1;2B", "Shift+Down") \
507 M("kmous", "\\E[M", "Mouse") \
508 M("knp", "\\E[6~", "PageDown") \
509 M("kpp", "\\E[5~", "PageUp") \
510 M("kri", "\\E[1;2A", "Shift+Up")
511
513 //
514
515 Capability {
516 .long_name = "Original colors"_sv,
517 .short_name = "oc"_tsv,
518 .value = "\\E]104\\007"_tsv,
519 .description = "Reset color palette via OSC 104"_sv,
520 // TODO: enable once we support OSC 104 to set the palette
521 .enabled = false,
522 },
523 Capability {
524 .long_name = "Original pair"_sv,
525 .short_name = "op"_tsv,
526 .value = "\\E[39;49m"_tsv,
527 .description = "Reset grahics rendition fg/bg via CSI 39;49 m"_sv,
528 },
529 Capability {
530 .long_name = "Restore cursor"_sv,
531 .short_name = "rc"_tsv,
532 .value = "\\E8"_tsv,
533 .description = "Reset cursor via ESC 8 (DECRC)"_sv,
534 },
535 Capability {
536 .long_name = "Repeat character"_sv,
537 .short_name = "rep"_tsv,
538 .value = "%p1%c\\E[%p2%{1}%-%db"_tsv, // Copied from ghostty/kitty
539 .description = "Repeat character via CSI Ps b"_sv,
540 },
541 Capability {
542 .long_name = "Reverse video"_sv,
543 .short_name = "rev"_tsv,
544 .value = "\\E[7m"_tsv,
545 .description = "Invert cell via SGR 7"_sv,
546 },
547 Capability {
548 .long_name = "Reverse index"_sv,
549 .short_name = "ri"_tsv,
550 .value = "\\EM"_tsv,
551 .description = "Reverse index (scroll down) via C1 RI (ESC M)"_sv,
552 },
553 Capability {
554 .long_name = "Scroll down"_sv,
555 .short_name = "rin"_tsv,
556 .value = "\\E[%p1%dT"_tsv,
557 .description = "Scroll down via CSI Ps T"_sv,
558 },
559 Capability {
560 .long_name = "Italic"_sv,
561 .short_name = "ritm"_tsv,
562 .value = "\\E[23m"_tsv,
563 .description = "Italicize cell via SGR 23"_sv,
564 },
565 Capability {
566 .long_name = "End alternate character set"_sv,
567 .short_name = "rmacs"_tsv,
568 .value = "\\E(B"_tsv,
569 .description = "End altnerate character set via ESC ( B"_sv,
570 // TODO: enable once box drawing charset is supported
571 .enabled = false,
572 },
573 Capability {
574 .long_name = "Reset automatic margins"_sv,
575 .short_name = "rmam"_tsv,
576 .value = "\\E[?7l"_tsv,
577 .description = "Disable auto-wrap via CSI ? 7 l"_sv,
578 },
579 Capability {
580 .long_name = "Reset alternate screen"_sv,
581 .short_name = "rmcup"_tsv,
582 .value = "\\E[?1049l"_tsv,
583 .description = "Leave alternate screen mode via CSI ? 1049 l"_sv,
584 },
585 Capability {
586 .long_name = "Exit insert mode"_sv,
587 .short_name = "rmir"_tsv,
588 .value = "\\E[4l"_tsv,
589 .description = "Leave insert mode via CSI 4 l"_sv,
590 // TODO: enable once insert mode is supported
591 .enabled = false,
592 },
593 Capability {
594 .long_name = "Exit keyboard transmit mode"_sv,
595 .short_name = "rmkx"_tsv,
596 .value = "\\E[?1l\\E>"_tsv,
597 // We don't yet support alternate keypad mode, but its safe to put the sequence in.
598 .description = "Reset keyboard modes via CSI ? 1 l (cursor keys) and ESC > (alternate keypad mode)"_sv,
599 },
600 Capability {
601 .long_name = "Exit standout mode"_sv,
602 .short_name = "rmso"_tsv,
603 .value = "\\E[27m"_tsv,
604 .description = "Exit standout mode via SGR 27 (clears inverted graphics rendition)"_sv,
605 },
606 Capability {
607 .long_name = "Exit underline"_sv,
608 .short_name = "rmul"_tsv,
609 .value = "\\E[24m"_tsv,
610 .description = "Exit underline via SGR 24"_sv,
611 },
612 Capability {
613 .long_name = "Reset string"_sv,
614 .short_name = "rs1"_tsv,
615 // We don't yet support ESC c (RIS), but its safe to include.
616 .value = R"(\E]\E\\\Ec)"_tsv, // Copied from ghostty/kitty
617 .description = "Reset via empty OSC sequence followed by ESC c (full reset)"_sv,
618 },
619 Capability {
620 .long_name = "Set cursor"_sv,
621 .short_name = "sc"_tsv,
622 .value = "\\E7"_tsv,
623 .description = "Save the cursor via ESC 7"_sv,
624 },
625 Capability {
626 .long_name = "Set background color"_sv,
627 .short_name = "setab"_tsv,
628 .value = "\\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m"_tsv, // Copied from ghostty/kitty
629 .description = "Set the graphics background via CSI 48"_sv,
630 },
631 Capability {
632 .long_name = "Set foreground color"_sv,
633 .short_name = "setaf"_tsv,
634 .value = "\\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m"_tsv, // Copied from ghostty/kitty
635 .description = "Set the graphics foregroup via CSI 38"_sv,
636 },
637 Capability {
638 .long_name = "Set graphics rendition"_sv,
639 .short_name = "sgr"_tsv,
640 // TODO: since we don't yet support box drawing characters I removed the first conditional.
641 // .value =
642 // "%?%p9%t\\E(0%e\\E(B%;\\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m"_sv,
643 // Copied from xterm
644 .value = "\\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m"_tsv,
645 .description = "Set the graphics rendition via CSI m, and charset via ESC ( C"_sv,
646
647 },
648 Capability {
649 .long_name = "Reset graphics rendition"_sv,
650 .short_name = "sgr0"_tsv,
652 // TODO: since we don't yet support box drawing characters I removed the first conditional.
653 .value = "\\E[m"_tsv,
654 .description = "Reset the graphics rendition via CSI m and charset via ESC ( B"_sv,
655
656 },
657 Capability {
658 .long_name = "Set italics"_sv,
659 .short_name = "sitm"_tsv,
660 .value = "\\E[3m"_tsv,
661 .description = "Set italics via SGR 3"_sv,
662 },
663 Capability {
664 .long_name = "Enter alternate charset"_sv,
665 .short_name = "smacs"_tsv,
666 .value = "\\E(0"_tsv,
667 .description = "Enter box drawing charset via ESC ( 0"_sv,
668 // TODO: enable once we support box drawing charset
669 .enabled = false,
670 },
671 Capability {
672 .long_name = "Set automatic margins"_sv,
673 .short_name = "smam"_tsv,
674 .value = "\\E[?7h"_tsv,
675 .description = "Enable auto-wrap via CSI ? 7 h"_sv,
676 },
677 Capability {
678 .long_name = "Set alternate screen"_sv,
679 .short_name = "smcup"_tsv,
680 .value = "\\E[?1049h"_tsv,
681 .description = "Enter alternate screen mode via CSI ? 1049 h"_sv,
682 },
683 Capability {
684 .long_name = "Enter insert mode"_sv,
685 .short_name = "smir"_tsv,
686 .value = "\\E[4h"_tsv,
687 .description = "Enter insert mode via CSI 4 h"_sv,
688 // TODO: enable once insert mode is supported
689 .enabled = false,
690 },
691 Capability {
692 .long_name = "Enter keyboard transmit mode"_sv,
693 .short_name = "smkx"_tsv,
694 .value = "\\E[?1h\\E="_tsv,
695 // We don't yet support alternate keypad mode, but its safe to put the sequence in.
696 .description = "Enter keyboard modes via CSI ? 1 h (cursor keys) and ESC = (alternate keypad mode)"_sv,
697 },
698 Capability {
699 .long_name = "Enter standout mode"_sv,
700 .short_name = "smso"_tsv,
701 .value = "\\E[7m"_tsv,
702 .description = "Enter standout mode via SGR 7 (inverted graphics rendition)"_sv,
703 },
704 Capability {
705 .long_name = "Enter underline"_sv,
706 .short_name = "smul"_tsv,
707 .value = "\\E[4m"_tsv,
708 .description = "Enter underline via SGR 4"_sv,
709 },
710 Capability {
711 .long_name = "Clear all tabs"_sv,
712 .short_name = "tbc"_tsv,
713 .value = "\\E[3g"_tsv,
714 .description = "Clear all tabstops via CSI 3 g"_sv,
715 },
716 Capability {
717 .long_name = "Move to status line"_sv,
718 .short_name = "tsl"_tsv,
719 .value = "\\E]2;"_tsv,
720 .description = "Enter status line (window title) via OSC 2"_sv,
721 // TODO: enable after supporting OSC 1/2
722 .enabled = false,
723 },
724 Capability {
725 .long_name = "User string 6"_sv,
726 .short_name = "u6"_tsv,
727 .value = "\\E[%i%d;%dR"_tsv, // Copied from ghostty/kitty
728 .description = "String format of cursor position reports CSI Ps ; Ps R"_sv,
729 },
730 Capability {
731 .long_name = "User string 7"_sv,
732 .short_name = "u7"_tsv,
733 .value = "\\E[6n"_tsv, // Copied from ghostty/kitty
734 .description = "Device status report (cursor position) via CSI 6 n"_sv,
735 },
736 Capability {
737 .long_name = "User string 8"_sv,
738 .short_name = "u8"_tsv,
739 .value = "\\E[?%[;0123456789]c"_tsv, // Copied from ghostty/kitty
740 .description = "String format of primary device attributes response - CSI ? Ps c"_sv,
741 },
742 Capability {
743 .long_name = "User string 9"_sv,
744 .short_name = "u9"_tsv,
745 .value = "\\E[c"_tsv, // Copied from ghostty/kitty
746 .description = "Device primary attributes (DA1) via CSI c"_sv,
747 },
748 Capability {
749 .long_name = "Vertical position absolute"_sv,
750 .short_name = "vpa"_tsv,
751 .value = "\\E[%i%p1%dd"_tsv,
752 .description = "Set cursor vertical position via CSI Ps d"_sv,
753 },
754 Capability {
755 .long_name = "Leave bracketed paste"_sv,
756 .short_name = "BD"_tsv,
757 .value = "\\E[?2004l"_tsv,
758 .description = "Leave bracketed paste via CSI ? 2004 l"_sv,
759 },
760 Capability {
761 .long_name = "Enter bracketed paste"_sv,
762 .short_name = "BE"_tsv,
763 .value = "\\E[?2004h"_tsv,
764 .description = "Enter bracketed paste via CSI ? 2004 h"_sv,
765 },
766 Capability {
767 .long_name = "Reset horizontal margins"_sv,
768 .short_name = "Clmg"_tsv,
769 .value = "\\E[s"_tsv,
770 .description = "Reset horizontal margins via CSI s"_sv,
771 // TODO: enable with support for horizontal margins
772 .enabled = false,
773 },
774 Capability {
775 .long_name = "Set horizontal margins"_sv,
776 .short_name = "Cmg"_tsv,
777 .value = "\\E[%i%p1%d;%p2%ds"_tsv,
778 .description = "Set horizontal margins via CSI Ps ; Ps s"_sv,
779 // TODO: enable with support for horizontal margins
780 .enabled = false,
781 },
782 Capability {
783 .long_name = "Reset cursor color"_sv,
784 .short_name = "Cr"_tsv,
785 .value = "\\E]112\\007"_tsv, // Copied from kitty
786 .description = "Reset cursor palette color via OSC 112"_sv,
787 // TODO: enable after support dynamic palette (OSC 12+112)
788 .enabled = false,
789 },
790 Capability {
791 .long_name = "Set cursor color"_sv,
792 .short_name = "Cs"_tsv,
793 .value = "\\E]12;%p1%s\\007"_tsv, // Copied from kitty
794 .description = "Set cursor palette color via OSC 12"_sv,
795 // TODO: enable after support dynamic palette (OSC 12+112)
796 .enabled = false,
797 },
798 Capability {
799 .long_name = "Disable horizontal margins"_sv,
800 .short_name = "Dsmg"_tsv,
801 .value = "\\E[?69l"_tsv,
802 .description = "Disable horizontal margin mode via CSI ? 69 l"_sv,
803 // TODO: enable with support for horizontal margins
804 .enabled = false,
805 },
806 Capability {
807 .long_name = "Clear with scroll back"_sv,
808 .short_name = "E3"_tsv,
809 .value = "\\E[3J"_tsv,
810 .description = "Clear screen including scroll back via CSI 3 J"_sv,
811 },
812 Capability {
813 .long_name = "Enable horizontal margins"_sv,
814 .short_name = "Enmg"_tsv,
815 .value = "\\E[?69h"_tsv,
816 .description = "Enable horizontal margin mode via CSI ? 69 h"_sv,
817 // TODO: enable with support for horizontal margins
818 .enabled = false,
819 },
820 Capability {
821 .long_name = "Save clipboard"_sv,
822 .short_name = "Ms"_tsv,
823 .value = "\\E]52;%p1%s;%p2%s\\007"_tsv, // Copied from ghostty/kitty
824 .description = "Set clipboard via OSC 52"_sv,
825 },
826 Capability {
827 .long_name = "Bracketed paste end"_sv,
828 .short_name = "PE"_tsv,
829 .value = "\\E[201~"_tsv,
830 .description = "Terminal uses CSI 201 ~ to end a bracketed paste"_sv,
831 },
832 Capability {
833 .long_name = "Bracketed paste start"_sv,
834 .short_name = "PS"_tsv,
835 .value = "\\E[200~"_tsv,
836 .description = "Terminal uses CSI 200 ~ to start a bracketed paste"_sv,
837 },
838 Capability {
839 .long_name = "Report version"_sv,
840 .short_name = "RV"_tsv,
841 .value = "\\E[>c"_tsv,
842 .description = "Request secondary device attributes via CSI > c"_sv,
843 },
844 Capability {
845 .long_name = "Reset cursor style"_sv,
846 .short_name = "Se"_tsv,
847 .value = "\\E[2 q"_tsv,
848 .description = "Reset cursor style via CSI 2 SP q (steady block cursor)"_sv,
849 },
850 Capability {
851 .long_name = "Set underline color"_sv,
852 .short_name = "Setulc"_tsv,
853 .value = "\\E[58:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d%;m"_tsv, // Copied from ghostty/kitty
854 .description = "Set underline color via SGR 58"_sv,
855 },
856 Capability {
857 .long_name = "Set extended underline"_sv,
858 .short_name = "Smulx"_tsv,
859 .value = "\\E[4:%p1%dm"_tsv, // Copied from ghostty/kitty
860 .description = "Set extended unline mode via SGR 4:Ps"_sv,
861 },
862 Capability {
863 .long_name = "Set cursor style"_sv,
864 .short_name = "Ss"_tsv,
865 .value = "\\E[%p1%d q"_tsv,
866 .description = "Set cursor style via CSI Ps SP q"_sv,
867 },
868 Capability {
869 .long_name = "Synchronized output"_sv,
870 .short_name = "Sync"_tsv,
871 .value = "\\E[?2026%?%p1%{1}%-%tl%eh%;"_tsv, // Copied from ghostty (kitty uses a DCS sequence)
872 .description = "Toggle synchronized output via CSI ? 2026 h/l"_sv,
873 },
874 Capability {
875 .long_name = "Extended mouse"_sv,
876 .short_name = "XM"_tsv,
877 .value = "\\E[?1006;1000%?%p1%{1}%=%th%el%;"_tsv, // Copied from ghostty
878 .description = "Toggle SGR mouse mode via CSI ? 1006 ; 1000 h/l"_sv,
879 },
880 Capability {
881 .long_name = "Extended version"_sv,
882 .short_name = "XR"_tsv,
883 .value = "\\E[>0q"_tsv, // Copied from ghostty
884 .description = "Request XTVERSION via CSI > 0 q"_sv,
885 // TODO: enable after supporting XTVERSION
886 .enabled = false,
887 },
888 Capability {
889 .long_name = "Reset focus reports"_sv,
890 .short_name = "fd"_tsv,
891 .value = "\\E[?1004l"_tsv,
892 .description = "Reset focus reports via CSI ? 1004 l"_sv,
893 },
894 Capability {
895 .long_name = "Set focus reports"_sv,
896 .short_name = "fe"_tsv,
897 .value = "\\E[?1004h"_tsv,
898 .description = "Set focus reports via CSI ? 1004 h"_sv,
899 },
900
901#define KEYS2(M) \
902 M("kBEG3", "\\E[1;3E", "Alt+Begin") \
903 M("kBEG4", "\\E[1;4E", "Alt+Shift+Begin") \
904 M("kBEG5", "\\E[1;5E", "Control+Begin") \
905 M("kBEG6", "\\E[1;6E", "Control+Shift+Begin") \
906 M("kBEG7", "\\E[1;7E", "Control+Alt+Begin") \
907 M("kDC3", "\\E[3;3~", "Alt+Delete") \
908 M("kDC4", "\\E[3;4~", "Alt+Shift+Delete") \
909 M("kDC5", "\\E[3;5~", "Control+Delete") \
910 M("kDC6", "\\E[3;6~", "Control+Shift+Delete") \
911 M("kDC7", "\\E[3;7~", "Control+Alt+Delete") \
912 M("kDN", "\\E[1;2B", "Shift+Down") \
913 M("kDN3", "\\E[1;3B", "Alt+Down") \
914 M("kDN4", "\\E[1;4B", "Alt+Shift+Down") \
915 M("kDN5", "\\E[1;5B", "Control+Down") \
916 M("kDN6", "\\E[1;6B", "Control+Shift+Down") \
917 M("kDN7", "\\E[1;7B", "Control+Alt+Down") \
918 M("kEND3", "\\E[1;3F", "Alt+End") \
919 M("kEND4", "\\E[1;4F", "Alt+Shift+End") \
920 M("kEND5", "\\E[1;5F", "Control+End") \
921 M("kEND6", "\\E[1;6F", "Control+Shift+End") \
922 M("kEND7", "\\E[1;7F", "Control+Alt+End") \
923 M("kHOM3", "\\E[1;3H", "Alt+Home") \
924 M("kHOM4", "\\E[1;4H", "Alt+Shift+Home") \
925 M("kHOM5", "\\E[1;5H", "Control+Home") \
926 M("kHOM6", "\\E[1;6H", "Control+Shift+Home") \
927 M("kHOM7", "\\E[1;7H", "Control+Alt+Home") \
928 M("kIC3", "\\E[2;3~", "Alt+Insert") \
929 M("kIC4", "\\E[2;4~", "Alt+Shift+Insert") \
930 M("kIC5", "\\E[2;5~", "Control+Insert") \
931 M("kIC6", "\\E[2;6~", "Control+Shift+Insert") \
932 M("kIC7", "\\E[2;7~", "Control+Alt+Insert") \
933 M("kLFT3", "\\E[1;3D", "Alt+Left") \
934 M("kLFT4", "\\E[1;4D", "Alt+Shift+Left") \
935 M("kLFT5", "\\E[1;5D", "Control+Left") \
936 M("kLFT6", "\\E[1;6D", "Control+Shift+Left") \
937 M("kLFT7", "\\E[1;7D", "Control+Alt+Left") \
938 M("kNXT3", "\\E[6;3~", "Alt+PageDown") \
939 M("kNXT4", "\\E[6;4~", "Alt+Shift+PageDown") \
940 M("kNXT5", "\\E[6;5~", "Control+PageDown") \
941 M("kNXT6", "\\E[6;6~", "Control+Shift+PageDown") \
942 M("kNXT7", "\\E[6;7~", "Control+Alt+PageDown") \
943 M("kPRV3", "\\E[5;3~", "Alt+PageUp") \
944 M("kPRV4", "\\E[5;4~", "Alt+Shift+PageUp") \
945 M("kPRV5", "\\E[5;5~", "Control+PageUp") \
946 M("kPRV6", "\\E[5;6~", "Control+Shift+PageUp") \
947 M("kPRV7", "\\E[5;7~", "Control+Alt+PageUp") \
948 M("kRIT3", "\\E[1;3C", "Alt+Right") \
949 M("kRIT4", "\\E[1;4C", "Alt+Shift+Right") \
950 M("kRIT5", "\\E[1;5C", "Control+Right") \
951 M("kRIT6", "\\E[1;6C", "Control+Shift+Right") \
952 M("kRIT7", "\\E[1;7C", "Control+Alt+Right") \
953 M("kUP", "\\E[1;2A", "Shift+Up") \
954 M("kUP3", "\\E[1;3A", "Alt+Up") \
955 M("kUP4", "\\E[1;4A", "Alt+Shift+Up") \
956 M("kUP5", "\\E[1;5A", "Control+Up") \
957 M("kUP6", "\\E[1;6A", "Control+Shift+Up") \
958 M("kUP7", "\\E[1;7A", "Control+Alt+Up")
959
961 //
962
963 Capability {
964 .long_name = "Focus in"_sv,
965 .short_name = "kxIN"_tsv,
966 .value = "\\E[I"_tsv,
967 .description = "Report send by terminal when gaining focus - CSI I"_sv,
968 },
969 Capability {
970 .long_name = "Focus out"_sv,
971 .short_name = "kxOUT"_tsv,
972 .value = "\\E[O"_tsv,
973 .description = "Report send by terminal when losing focus - CSI o"_sv,
974 },
975 Capability {
976 .long_name = "Reset strikethrough"_sv,
977 .short_name = "rmxx"_tsv,
978 .value = "\\E[29m"_tsv,
979 .description = "Reset strikethrough cell via SGR 29"_sv,
980 },
981 Capability {
982 .long_name = "Report version response"_sv,
983 .short_name = "rv"_tsv,
984 // NOTE: this value looks wrong, as the response should include a '<' after the CSI. However,
985 // both ghostty and xterm leave it off. Probably no one uses this string.
986 .value = R"(\E\\[[0-9]+;[0-9]+;[0-9]+c)"_tsv, // Copied from ghostty
987 .description = "String format of device secondary attirbutes response - CSI < Ps ; Ps ; Ps c"_sv,
988 },
989 Capability {
990 .long_name = "Set RGB background"_sv,
991 .short_name = "setrgbb"_tsv,
992 .value = "\\E[48:2:%p1%d:%p2%d:%p3%dm"_tsv, // Copied from ghostty/kitty
993 .description = "Set RGB background via SGR 48"_sv,
994 },
995 Capability {
996 .long_name = "Set RGB foreground"_sv,
997 .short_name = "setrgbf"_tsv,
998 .value = "\\E[38:2:%p1%d:%p2%d:%p3%dm"_tsv, // Copied from ghostty/kitty
999 .description = "Set RGB foreground via SGR 38"_sv,
1000 },
1001 Capability {
1002 .long_name = "Strikethrough"_sv,
1003 .short_name = "smxx"_tsv,
1004 .value = "\\E[9m"_tsv,
1005 .description = "Set strikethrough cell via SGR 9"_sv,
1006 },
1007 Capability {
1008 .long_name = "Extended mouse report"_sv,
1009 .short_name = "xm"_tsv,
1010 .value = "\\E[<%i%p3%d;%p1%d;%p2%d;%?%p4%tM%em%;"_tsv, // Copied from ghostty
1011 .description = "Format of extended mouse reports - CSI Ps ; Ps ; Ps M/m"_sv,
1012 },
1013 Capability {
1014 .long_name = "Extended version report"_sv,
1015 .short_name = "xr"_tsv,
1016 .value = R"(\EP>\|[ -~]+a\E\\)"_tsv, // Copied from ghostty
1017 .description = "Format of XTVERSION response - DCS > version ST"_sv,
1018 // TODO: enable after supporting XTVERSION
1019 .enabled = false,
1020 },
1021};
1022
1023constexpr auto ttx_terminfo = Terminfo {
1024 .names = ttx_names,
1025 .capabilities = ttx_capabilities,
1026};
1027}
#define KEY_CAP(short, v, name)
#define KEYS(M)
#define KEYS2(M)
Definition absolute_position.h:6
constexpr auto ttx_names
Definition capabilities.h:6
constexpr auto ttx_terminfo
Definition capabilities.h:1023
constexpr auto ttx_capabilities
Definition capabilities.h:20
Represents a Termcap capability.
Definition capability.h:10
Represents a terminfo entry.
Definition capability.h:30