2 ****************************************************************************
3 * Copyright (c) 2017,2018 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************
29 * @Id: user_caps.5,v 1.7 2018/02/17 19:07:01 tom Exp @
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
34 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
35 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
36 <TITLE>user_caps 5</TITLE>
37 <link rev=made href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
41 <H1 class="no-header">user_caps 5</H1>
43 <STRONG><A HREF="user_caps.5.html">user_caps(5)</A></STRONG> File Formats Manual <STRONG><A HREF="user_caps.5.html">user_caps(5)</A></STRONG>
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49 user_caps - user-defined terminfo capabilities
52 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
53 <STRONG>tic</STRONG> <STRONG>-x,</STRONG> <STRONG>infocmp</STRONG> <STRONG>-x</STRONG>
56 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
58 </PRE><H3><a name="h3-Background">Background</a></H3><PRE>
59 Before ncurses 5.0, terminfo databases used a <EM>fixed</EM> <EM>repertoire</EM> of ter-
60 minal capabilities designed for the SVr2 terminal database in 1984, and
61 extended in stages through SVr4 (1989), and standardized in the Single
62 Unix Specification beginning in 1995.
64 Most of the <EM>extensions</EM> in this fixed repertoire were additions to the
65 tables of boolean, numeric and string capabilities. Rather than change
66 the meaning of an existing capability, a new name was added. The ter-
67 minfo database uses a binary format; binary compatibility was ensured
68 by using a header which gave the number of items in the tables for each
69 type of capability. The standardization was incomplete:
71 <STRONG>o</STRONG> The <EM>binary</EM> <EM>format</EM> itself is not described in the X/Open Curses doc-
72 umentation. Only the <EM>source</EM> <EM>format</EM> is described.
74 Library developers rely upon the SVr4 documentation, and reverse-
75 engineering the compiled terminfo files to match the binary format.
77 <STRONG>o</STRONG> Lacking a standard for the binary format, most implementations copy
78 the SVr2 binary format, which uses 16-bit signed integers, and is
79 limited to 4096-byte entries.
81 The format cannot represent very large numeric capabilities, nor
82 can it represent large numbers of special keyboard definitions.
84 <STRONG>o</STRONG> The tables of capability names differ between implementations.
86 Although they <EM>may</EM> provide all of the standard capability names, the
87 position in the tables differs because some features were added as
88 needed, while others were added (out of order) to comply with
91 While ncurses' repertoire of predefined capabilities is closest to
92 Solaris, Solaris's terminfo database has a few differences from the
93 list published by X/Open Curses.
95 During the 1990s, some users were reluctant to use terminfo in spite of
96 its performance advantages over termcap:
98 <STRONG>o</STRONG> The fixed repertoire prevented users from adding features for unan-
99 ticipated terminal improvements (or required them to reuse existing
100 capabilities as a workaround).
102 <STRONG>o</STRONG> The limitation to 16-bit signed integers was also mentioned.
103 Because termcap stores everything as a string, it could represent
106 Although termcap's extensibility was rarely used (it was never the
107 <EM>speaker</EM> who had actually used the feature), the criticism had a point.
108 ncurses 5.0 provided a way to detect nonstandard capabilities, deter-
109 mine their type and optionally store and retrieve them in a way which
110 did not interfere with other applications. These are referred to as
111 <EM>user-defined</EM> <EM>capabilities</EM> because no modifications to the toolset's
112 predefined capability names are needed.
114 The ncurses utilities <STRONG>tic</STRONG> and <STRONG>infocmp</STRONG> have a command-line option "-x"
115 to control whether the nonstandard capabilities are stored or
116 retrieved. A library function <STRONG>use_extended_names</STRONG> is provided for the
119 When compiling a terminal database, if "-x" is set, <STRONG>tic</STRONG> will store a
120 user-defined capability if the capability name is not one of the prede-
123 Because ncurses provides a termcap library interface, these user-
124 defined capabilities may be visible to termcap applications:
126 <STRONG>o</STRONG> The termcap interface (like all implementations of termcap)
127 requires that the capability names are 2-characters.
129 When the capability is simple enough for use in a termcap applica-
130 tion, it is provided as a 2-character name.
132 <STRONG>o</STRONG> There are other user-defined capabilities which refer to features
133 not usable in termcap, e.g., parameterized strings that use more
134 than two parameters or use more than the trivial expression support
135 provided by termcap. For these, the terminfo database should have
136 only capability names with 3 or more characters.
138 <STRONG>o</STRONG> Some terminals can send distinct strings for special keys (cursor-,
139 keypad- or function-keys) depending on modifier keys (shift, con-
140 trol, etc.). While terminfo and termcap have a set of 60 prede-
141 fined function-key names, to which a series of keys can be
142 assigned, that is insufficient for more than a dozen keys multi-
143 plied by more than a couple of modifier combinations. The ncurses
144 database uses a convention based on <STRONG>xterm</STRONG> to provide extended spe-
147 Fitting that into termcap's limitation of 2-character names would
148 be pointless. These extended keys are available only with ter-
152 </PRE><H3><a name="h3-Recognized-capabilities">Recognized capabilities</a></H3><PRE>
153 The ncurses library uses the user-definable capabilities. While the
154 terminfo database may have other extensions, ncurses makes explicit
157 AX <EM>boolean</EM>, asserts that the terminal interprets SGR 39 and SGR 49
158 by resetting the foreground and background color, respectively,
161 This is a feature recognized by the <STRONG>screen</STRONG> program as well.
163 E3 <EM>string</EM>, tells how to clear the terminal's scrollback buffer.
164 When present, the <STRONG><A HREF="clear.1.html">clear(1)</A></STRONG> program sends this before clearing the
167 The command "<STRONG>tput</STRONG> <STRONG>clear</STRONG>" does the same thing.
170 <EM>boolean</EM>, <EM>number</EM> <STRONG>or</STRONG> <EM>string</EM>, to assert that the <STRONG>set_a_foreground</STRONG>
171 and <STRONG>set_a_background</STRONG> capabilities correspond to <EM>direct</EM> <EM>colors</EM>,
172 using an RGB (red/green/blue) convention. This capability allows
173 the <STRONG>color_content</STRONG> function to return appropriate values without
174 requiring the application to initialize colors using <STRONG>init_color</STRONG>.
176 The capability type determines the values which ncurses sees:
179 implies that the number of bits for red, green and blue are
180 the same. Using the maximum number of colors, ncurses adds
181 two, divides that sum by three, and assigns the result to red,
182 green and blue in that order.
184 If the number of bits needed for the number of colors is not a
185 multiple of three, the blue (and green) components lose in
189 tells ncurses what result to add to red, green and blue. If
190 ncurses runs out of bits, blue (and green) lose just as in the
191 <EM>boolean</EM> case.
194 explicitly list the number of bits used for red, green and
195 blue components as a slash-separated list of decimal integers.
197 Because there are several RGB encodings in use, applications
198 which make assumptions about the number of bits per color are
199 unlikely to work reliably. As a trivial case, for example, one
200 could define <STRONG>RGB#1</STRONG> to represent the standard eight ANSI colors,
201 i.e., one bit per color.
203 U8 <EM>number</EM>, asserts that ncurses must use Unicode values for line-
204 drawing characters, and that it should ignore the alternate char-
205 acter set capabilities when the locale uses UTF-8 encoding. For
206 more information, see the discussion of <STRONG>NCURSES_NO_UTF8_ACS</STRONG> in
207 <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG>.
209 Set this capability to a nonzero value to enable it.
211 XM <EM>string</EM>, override ncurses's built-in string which enables/disables
212 <STRONG>xterm</STRONG> mouse mode.
215 </PRE><H3><a name="h3-Extended-key-definitions">Extended key-definitions</a></H3><PRE>
216 Several terminals provide the ability to send distinct strings for com-
217 binations of modified special keys. There is no standard for what
220 Since 1999, <STRONG>xterm</STRONG> has supported <EM>shift</EM>, <EM>control</EM>, <EM>alt</EM>, and <EM>meta</EM> modifiers
221 which produce distinct special-key strings. In a terminal description,
222 ncurses has no special knowledge of the modifiers used. Applications
223 can use the <EM>naming</EM> <EM>convention</EM> established for <STRONG>xterm</STRONG> to find these spe-
224 cial keys in the terminal description.
226 Starting with the curses convention that <EM>key</EM> <EM>names</EM> begin with "k" and
227 that shifted special keys are an uppercase name, ncurses' terminal
228 database defines these names to which a suffix is added:
230 <EM>Name</EM> <EM>Description</EM>
231 ---------------------------------------------------------------
232 kDC special form of kdch1 (delete character)
233 kDN special form of kcud1 (cursor down)
234 kEND special form of kend (End)
235 kHOM special form of khome (Home)
236 kLFT special form of kcub1 (cursor-left or cursor-back)
237 kNXT special form of knext (Next, or Page-Down)
238 kPRV special form of kprev (Prev, or Page-Up)
239 kRIT special form of kcuf1 (cursor-right, or cursor-forward)
240 kUP special form of kcuu1 (cursor-up)
242 These are the suffixes used to denote the modifiers:
244 <EM>Value</EM> <EM>Description</EM>
245 ----------------------------------
253 8 Shift + Alt + Control
257 12 Meta + Alt + Shift
259 14 Meta + Ctrl + Shift
261 16 Meta + Ctrl + Alt + Shift
263 None of these are predefined; terminal descriptions can refer to <EM>names</EM>
264 which ncurses will allocate at runtime to <EM>key-codes</EM>. To use these keys
265 in an ncurses program, an application could do this:
267 <STRONG>o</STRONG> using a list of extended key <EM>names</EM>, ask <STRONG><A HREF="curs_terminfo.3x.html">tigetstr(3x)</A></STRONG> for their val-
270 <STRONG>o</STRONG> given the list of values, ask <STRONG><A HREF="key_defined.3x.html">key_defined(3x)</A></STRONG> for the <EM>key-code</EM>
271 which would be returned for those keys by <STRONG><A HREF="curs_getch.3x.html">wgetch(3x)</A></STRONG>.
274 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
275 The "-x" extension feature of <STRONG>tic</STRONG> and <STRONG>infocmp</STRONG> has been adopted in Net-
276 BSD curses. That implementation stores user-defined capabilities, but
277 makes no use of these capabilities itself.
280 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
281 <STRONG><A HREF="tic.1m.html">tic(1)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1)</A></STRONG>.
284 </PRE><H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
286 beginning with ncurses 5.0 (1999)
290 <STRONG><A HREF="user_caps.5.html">user_caps(5)</A></STRONG>
294 <li><a href="#h2-NAME">NAME</a></li>
295 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
296 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
298 <li><a href="#h3-Background">Background</a></li>
299 <li><a href="#h3-Recognized-capabilities">Recognized capabilities</a></li>
300 <li><a href="#h3-Extended-key-definitions">Extended key-definitions</a></li>
303 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
304 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
305 <li><a href="#h2-AUTHORS">AUTHORS</a></li>