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