| user_caps(5) | File formats | user_caps(5) |
user_caps - user-defined terminfo capability format
ginfocmp -x
gtic -x
Prior to ncurses 5.0 (1999), terminfo databases used a fixed repertoire of terminal capabilities designed for the SVr2 terminal database in 1984, added to in stages through SVr4 (1989), and standardized in X/Open Curses starting in 1995.
Most such additions to this fixed repertoire suppelmented the tables of Boolean, numeric, and string capabilities. Rather than changing the meaning of an existing capability, a new name was added. The terminfo database uses a binary format; binary compatibility was ensured by using a header that counted the number of items in the tables for each type of capability. Because each curses vendor extended the standard capability lists in distinct ways, a library could be programmed to recognize only compiled terminfo entries that it was prepared to interpret. Standardization was incomplete.
During the 1990s, some application developers were reluctant to use terminfo in spite of its performance (and other) advantages over termcap.
Although termcap's extensibility was rarely used — the claimant was never an implementor who had actually exercised it — the criticism had a point. ncurses 5.0 provided a way to detect nonstandard capabilities, to determine their type, and to optionally store and retrieve them in a way that did not interfere with other applications. ncurses terms these user-defined capabilities because no modifications to the standard capability list are needed.
The ncurses utilities gtic and ginfocmp have a command-line option “-x” to control whether the nonstandard capabilities are stored or retrieved. ncurses provides use_extended_names(3X) to programs for the same purpose.
When compiling a terminal database, if “-x” is used, gtic stores a user-defined capability if the capability name is not standard.
Because ncurses provides a termcap library interface, these user-defined capabilities may be visible to termcap applications.
The ncurses library employs user-definable capabilities. While the terminfo database may have other extensions, ncurses makes explicit checks for the following.
xterm+x11mouse|X11 xterm mouse protocol,
kmous=\E[M, XM=\E[?1000%?%p1%{1}%=%th%el%;,
xm=\E[M
%?%p4%t%p3%e%{3}%;%' '%+%c
%p2%'!'%+%c
%p1%'!'%+%c,
xterm+sm+1006|xterm SGR-mouse,
kmous=\E[<, XM=\E[?1006;1000%?%p1%{1}%=%th%el%;,
xm=\E[<%i%p3%d;
%p1%d;
%p2%d;
%?%p4%tM%em%;,
Several terminals provide the ability to send distinct strings for combinations of modified special keys. There is no standard for what those keys can send.
Since 1999, xterm(1) has supported shift, control, alt, and meta modifiers which produce distinct special-key strings. In a terminal description, ncurses has no special knowledge of the modifiers used. Applications can use the naming convention established for xterm to find these special keys in the terminal description.
Starting with the curses convention that capability codes describing the input generated by a terminal's key caps begin with “k”, and that shifted special keys use uppercase letters in their names, ncurses's terminal database defines the following names and codes to which a suffix is added.
| Code | Description |
| kDC | shifted kdch1 (delete character) |
| kDN | shifted kcud1 (cursor down) |
| kEND | shifted kend (end) |
| kHOM | shifted khome (home) |
| kLFT | shifted kcub1 (cursor back) |
| kNXT | shifted knext (next) |
| kPRV | shifted kprev (previous) |
| kRIT | shifted kcuf1 (cursor forward) |
| kUP | shifted kcuu1 (cursor up) |
Keycap nomenclature on the Unix systems for which curses was developed differs from today's ubiquitous descendants of the IBM PC/AT keyboard layout. In the foregoing, interpret “backward” as “left”, “forward” as “right”, “next” as “page down”, and “prev(ious)” as “page up”.
These are the suffixes used to denote the modifiers:
| Value | Description |
| 2 | Shift |
| 3 | Alt |
| 4 | Shift + Alt |
| 5 | Control |
| 6 | Shift + Control |
| 7 | Alt + Control |
| 8 | Shift + Alt + Control |
| 9 | Meta |
| 10 | Meta + Shift |
| 11 | Meta + Alt |
| 12 | Meta + Alt + Shift |
| 13 | Meta + Ctrl |
| 14 | Meta + Ctrl + Shift |
| 15 | Meta + Ctrl + Alt |
| 16 | Meta + Ctrl + Alt + Shift |
ncurses defines no capabilities for modified F-keys; terminal descriptions can refer to names that ncurses allocates at runtime to key codes. To use these keys in an ncurses program, an application could do this:
The “-x” extension feature of gtic and ginfocmp has been adopted in NetBSD curses. That implementation stores user-defined capabilities, but makes no use of these capabilities itself.
Thomas E. Dickey
beginning with ncurses 5.0 (1999)
In the source form of the terminal database, terminfo.src, the section “NCURSES USER-DEFINABLE CAPABILITIES”. summarizes commonly-used user-defined capabilities employed in the terminal descriptions. Some of those features are mentioned in screen(1) or tmux(1).
XTerm Control Sequences provides further information on the xterm(1) features that are used in these extended capabilities.
| 2025-11-11 | ncurses 6.6 |