]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/user_caps.5.html
ncurses 6.0 - patch 20171007
[ncurses.git] / doc / html / man / user_caps.5.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 2017 Free Software Foundation, Inc.                        *
4   *                                                                          *
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:                 *
12   *                                                                          *
13   * The above copyright notice and this permission notice shall be included  *
14   * in all copies or substantial portions of the Software.                   *
15   *                                                                          *
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.                               *
23   *                                                                          *
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       *
27   * authorization.                                                           *
28   ****************************************************************************
29   * @Id: user_caps.5,v 1.2 2017/09/04 19:27:24 tom Exp @
30 -->
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
32 <HTML>
33 <HEAD>
34 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
35 <meta name="generator" content="Manpage converted by man2html - see http://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">
39 </HEAD>
40 <BODY>
41 <H1 class="no-header">user_caps 5</H1>
42 <PRE>
43 <STRONG><A HREF="user_caps.5.html">user_caps(5)</A></STRONG>                                                      <STRONG><A HREF="user_caps.5.html">user_caps(5)</A></STRONG>
44
45
46
47
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49        user_caps - user-defined terminfo capabilities
50
51
52 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
53        <STRONG>tic</STRONG> <STRONG>-x,</STRONG> <STRONG>infocmp</STRONG> <STRONG>-x</STRONG>
54
55
56 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
57
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.
63
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:
70
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.
73
74            Library developers rely upon the SVr4 documentation,  and  reverse-
75            engineering the compiled terminfo files to match the binary format.
76
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.
80
81            The  format  cannot  represent very large numeric capabilities, nor
82            can it represent large numbers of special keyboard definitions.
83
84        <STRONG>o</STRONG>   The tables of capability names differ between implementations.
85
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
89            X/Open Curses.
90
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.
94
95        During the 1990s, some users were reluctant to use terminfo in spite of
96        its performance advantages over termcap:
97
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).
101
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
104            larger numbers.
105
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.
113
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
117        same purpose.
118
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-
121        fined names.
122
123        Because  ncurses  provides  a  termcap  library  interface, these user-
124        defined capabilities may be visible to termcap applications:
125
126        <STRONG>o</STRONG>   The  termcap  interface  (like  all  implementations  of   termcap)
127            requires that the capability names are 2-characters.
128
129            When  the capability is simple enough for use in a termcap applica-
130            tion, it is provided as a 2-character name.
131
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.
137
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-
145            cial-key names.
146
147            Fitting  that  into termcap's limitation of 2-character names would
148            be pointless.  These extended keys are  available  only  with  ter-
149            minfo.
150
151
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
155        checks for these:
156
157           AX <EM>boolean</EM>,  asserts  that the terminal interprets SGR 39 and SGR 49
158              by resetting the foreground and background  color,  respectively,
159              to the default.
160
161              This is a feature recognized by the <STRONG>screen</STRONG> program as well.
162
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
165              terminal.
166
167              The command "<STRONG>tput</STRONG> <STRONG>clear</STRONG>" does the same thing.
168
169           RGB
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>.
175
176              The capability type determines the values which ncurses sees:
177
178              <EM>boolean</EM>
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.
183
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
186                 comparison to red.
187
188              <EM>number</EM>
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.
192
193              <EM>string</EM>
194                 explicitly list the number of bits used  for  red,  green  and
195                 blue components as a slash-separated list of decimal integers.
196
197           U8 <EM>boolean</EM>,  asserts  that ncurses must use Unicode values for line-
198              drawing characters, and that it should ignore the alternate char-
199              acter  set capabilities when the locale uses UTF-8 encoding.  For
200              more information, see the discussion  of  <STRONG>NCURSES_NO_UTF8_ACS</STRONG>  in
201              <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG>.
202
203              Set this capability to a nonzero value to enable it.
204
205           XM <EM>string</EM>, override ncurses's built-in string which enables/disables
206              <STRONG>xterm</STRONG> mouse mode.
207
208
209 </PRE><H3><a name="h3-Extended-key-definitions">Extended key-definitions</a></H3><PRE>
210        Several terminals provide the ability to send distinct strings for com-
211        binations  of  modified  special  keys.   There is no standard for what
212        those keys can send.
213
214        Since 1999, <STRONG>xterm</STRONG> has supported <EM>shift</EM>, <EM>control</EM>, <EM>alt</EM>, and <EM>meta</EM> modifiers
215        which produce distinct special-key strings.  In a terminal description,
216        ncurses has no special knowledge of the modifiers  used.   Applications
217        can  use the <EM>naming</EM> <EM>convention</EM> established for <STRONG>xterm</STRONG> to find these spe-
218        cial keys in the terminal description.
219
220        Starting with the curses convention that <EM>key</EM> <EM>names</EM> begin with  "k"  and
221        that  shifted  special  keys  are  an uppercase name, ncurses' terminal
222        database defines these names to which a suffix is added:
223
224             <EM>Name</EM>   <EM>Description</EM>
225             ---------------------------------------------------------------
226             kDC    special form of kdch1 (delete character)
227             kDN    special form of kcud1 (cursor down)
228             kEND   special form of kend (End)
229             kHOM   special form of khome (Home)
230             kLFT   special form of kcub1 (cursor-left or cursor-back)
231             kNXT   special form of knext (Next, or Page-Down)
232             kPRV   special form of kprev (Prev, or Page-Up)
233             kRIT   special form of kcuf1 (cursor-right, or cursor-forward)
234             kUP    special form of kcuu1 (cursor-up)
235
236        These are the suffixes used to denote the modifiers:
237
238             <EM>Value</EM>   <EM>Description</EM>
239             ----------------------------------
240             2       Shift
241             3       Alt
242             4       Shift + Alt
243             5       Control
244             6       Shift + Control
245             7       Alt + Control
246             8       Shift + Alt + Control
247             9       Meta
248
249             10      Meta + Shift
250             11      Meta + Alt
251             12      Meta + Alt + Shift
252             13      Meta + Ctrl
253             14      Meta + Ctrl + Shift
254             15      Meta + Ctrl + Alt
255             16      Meta + Ctrl + Alt + Shift
256
257        None of these are predefined; terminal descriptions can refer to  <EM>names</EM>
258        which ncurses will allocate at runtime to <EM>key-codes</EM>.  To use these keys
259        in an ncurses program, an application could do this:
260
261        <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-
262            ues, and
263
264        <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>
265            which would be returned for those keys by <STRONG><A HREF="curs_getch.3x.html">wgetch(3x)</A></STRONG>.
266
267
268 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
269        The "-x" extension feature of <STRONG>tic</STRONG> and <STRONG>infocmp</STRONG> has been adopted in  Net-
270        BSD  curses.  That implementation stores user-defined capabilities, but
271        makes no use of these capabilities itself.
272
273
274 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
275        <STRONG><A HREF="tic.1m.html">tic(1)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1)</A></STRONG>.
276
277
278 </PRE><H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
279        Thomas E. Dickey
280        beginning with ncurses 5.0 (1999)
281
282
283
284                                                                   <STRONG><A HREF="user_caps.5.html">user_caps(5)</A></STRONG>
285 </PRE>
286 <div class="nav">
287 <ul>
288 <li><a href="#h2-NAME">NAME</a></li>
289 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
290 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
291 <ul>
292 <li><a href="#h3-Background">Background</a></li>
293 <li><a href="#h3-Recognized-capabilities">Recognized capabilities</a></li>
294 <li><a href="#h3-Extended-key-definitions">Extended key-definitions</a></li>
295 </ul>
296 </li>
297 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
298 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
299 <li><a href="#h2-AUTHORS">AUTHORS</a></li>
300 </ul>
301 </div>
302 </BODY>
303 </HTML>