XTFMTKEYS, XTQFMTKEYS Key Format Options
Choose whether keys with modifiers are sent as CSI 27 ; m ; code ~ or as CSI code ; m u, and ask which is chosen.
XTFMTKEYS Set Key Format Options
CSI > Pp ; Pv f
XTQFMTKEYS Query Key Format Options
CSI > Pm g
- xterm
- Functions using CSI
XTMODKEYS says whether xterm sends a key with its modifiers as an escape sequence; these say how. Each of xterm’s modify…Keys resources has a format…Keys companion, and for the keys modifyOtherKeys covers, formatOtherKeys chooses between two forms of Control and ,:
formatOtherKeys | Sends |
|---|---|
0, the default | CSI 27 ; 5 ; 44 ~, function key 27 with the modifiers and the character |
1 | CSI 44 ; 5 u, the character with the modifiers |
The second is the form proposed by fixterms, and xterm added formatOtherKeys at its author’s request, in patch 235 (2008), as a resource only (modifyOtherKey). Patch 398 (2025) gave the other key categories a format resource each and added these sequences to set and ask for them, so a program can now ask for the CSI u form itself, with CSI > 4 ; 1 f alongside CSI > 4 ; 2 m.
Pp picks the resource, numbered as for XTMODKEYS:
Pp | Resource | Default |
|---|---|---|
0 | formatKeyboard | 0 |
1 | formatCursorKeys | 0 |
2 | formatFunctionKeys | 0 |
3 | formatKeypadKeys | 0 |
4 | formatOtherKeys | 0 |
6 | formatModifierKeys | 0 |
7 | formatSpecialKeys | 0 |
5 is reserved, as it is for XTMODKEYS. formatKeyboard has no resource to set it from, so it starts at 0 and only these sequences change it. The others take effect only where their modify…Keys resource is high enough to send an escape sequence at all.
The forms, in a default xterm (CASE_SET_FMT_KEYS, set_fmt_fkeys, report_fmt_fkeys):
CSI > Pp ; Pv fsets one toPv, which is not checked.CSI > Pp f, with no value, puts it back as it started.CSI > fchanges nothing: the code has a branch that would put back1to5when there are no parameters, but xterm counts an empty list as one parameter with its default,-1, so the branch is never taken and resource-1is set, which there is none of.CSI > Pp gasks, and is answered asCSI > Pp ; Pv f, a sequence that would set it back; several at once,CSI > 1 ; 4 g, get an answer each. A resource xterm does not have is answered with65535, the-1it stands for read as sixteen unsigned bits, and soCSI > g, which asks about resource-1, is answeredCSI > 65535 ; 65535 f.- DECRQSS asks as well, as
DCS $ q > Pp f ST, but the answer ends inm, as XTQMODKEYS’s does:DCS 1 $ r > Pp ; Pv m ST(misc.c). Sent back, that would set the XTMODKEYS resource of the same number. - DECSTR and RIS put them all back as they started (
ReallyReset).
xterm’s own Control Sequences documents the query as CSI ? Pp g (ctlseqs.ms), but its parser has the query only in the CSI > table, beside the set (dec2_table); in the CSI ? table g goes to the ground state (dec_table). So CSI ? 4 g is not answered, and CSI > 4 g is.
libghostty-vt ignores all of it: it reads the > and ? as intermediates and ignores f and g with any, so neither moves the cursor as HVP or clears a tab stop as TBC would. Its key encoder never sends the CSI u form for modifyOtherKeys. The cases follow a default xterm, so those that ask are known differences.
None of the other terminals this site runs has it, and two of them misread it. kitty 0.49.1 takes CSI > 2 ; 5 f for HVP and moves the cursor (XTFMTKEYS-10). pyte does the same, takes CSI > g for TBC and clears a tab stop (XTFMTKEYS-11), and raises an exception on CSI ? 4 g, which it hands to its tab-clearing method with a private argument the method does not take (XTFMTKEYS-9).
Support
| Terminal | Version | Support | Notes |
|---|---|---|---|
| VT220 | manual, 2nd ed., 1984 | No | not in the manual |
| VT510 | manual, 1st ed., 1993 | No | not in the manual |
| xterm | patch 412, xterm-411a | Yes | |
| libghostty-vt | 919dca5 | No | ignores both (XTFMTKEYS-1 to XTFMTKEYS-8, XTFMTKEYS-12) |
| kitty | 0.49.1, run in a VM | No | fails the 2 cases that show it working |
| foot | 1.28.0, run in a VM | No | fails the 2 cases that show it working |
| pyte | 0.8.2, run as a library | No | fails the 2 cases that show it working |
| xterm.js headless | 6.0.0, run as a library | No | fails the 2 cases that show it working |
| alacritty_terminal | 0.26.0, run as a library | No | fails the 2 cases that show it working |
| ConEmu | build 230724, its documentation | No | not in ConEmu’s list; ANSI escape codes |
| rxvt-unicode | 9.31, run in a VM | No | fails the 2 cases that show it working |
| VTE | 0.84.1, run as a library | No | fails the 2 cases that show it working |
Validation
XTFMTKEYS-1: The defaults
\e[>0;1;2;3;4;6;7g
|______|
reply \e[>0;0f\e[>1;0f\e[>2;0f\e[>3;0f\e[>4;0f\e[>6;0f\e[>7;0f
XTFMTKEYS-2: The fixterms form for modifyOtherKeys
\e[>4;1f
\e[>4g
|______|
reply \e[>4;1f
XTFMTKEYS-3: Put it back
\e[>4;1f
\e[>4f
\e[>4g
|______|
reply \e[>4;0f
XTFMTKEYS-4: Without a resource, nothing changes
\e[>1;1f
\e[>4;1f
\e[>6;1f
\e[>f
\e[>1;4;6g
|______|
reply \e[>1;1f\e[>4;1f\e[>6;1f
XTFMTKEYS-5: The value is not checked
\e[>4;9f
\e[>4g
|______|
reply \e[>4;9f
XTFMTKEYS-6: A resource xterm does not have
\e[>8g
|______|
reply \e[>8;65535f
XTFMTKEYS-7: DECSTR puts them back
\e[>4;1f
\e[!p
\e[>4g
|______|
reply \e[>4;0f
XTFMTKEYS-8: Through DECRQSS, ending in m
\e[>4;1f
\eP$q>4f\e\\
|______|
reply \eP1$r>4;1m\e\\
XTFMTKEYS-9: The documented query is not answered
\e[?4g
|______|
reply none
XTFMTKEYS-10: Not HVP
A
\e[>2;5f
B
|AB______|
|________|
cursor 1,3
XTFMTKEYS-11: Not TBC
\t # to the stop at column 9
\e[>g # what TBC would read as clearing it
\r\t
X
|________X___________|
XTFMTKEYS-12: A query with nothing to ask
\e[>g
|______|
reply \e[>65535;65535f