1 .\"***************************************************************************
2 .\" Copyright 2018-2020,2021 Thomas E. Dickey *
3 .\" Copyright 1998-2016,2017 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 .\"***************************************************************************
30 .\" $Id: terminfo.tail,v 1.107 2021/10/02 20:54:06 tom Exp $
32 .SS User-Defined Capabilities
34 The preceding section listed the \fIpredefined\fP capabilities.
35 They deal with some special features for terminals no longer
36 (or possibly never) produced.
37 Occasionally there are special features of newer terminals which
38 are awkward or impossible to represent by reusing the predefined
41 \fBncurses\fP addresses this limitation by allowing user-defined capabilities.
42 The \fB@TIC@\fP and \fB@INFOCMP@\fP programs provide
43 the \fB\-x\fP option for this purpose.
44 When \fB\-x\fP is set,
45 \fB@TIC@\fP treats unknown capabilities as user-defined.
46 That is, if \fB@TIC@\fP encounters a capability name
47 which it does not recognize,
48 it infers its type (boolean, number or string) from the syntax
49 and makes an extended table entry for that capability.
50 The \fBuse_extended_names\fP(3X) function makes this information
51 conditionally available to applications.
52 The ncurses library provides the data leaving most of the behavior
55 User-defined capability strings whose name begins
56 with \*(``k\*('' are treated as function keys.
58 The types (boolean, number, string) determined by \fB@TIC@\fP
59 can be inferred by successful calls on \fBtigetflag\fP, etc.
61 If the capability name happens to be two characters,
62 the capability is also available through the termcap interface.
64 While termcap is said to be extensible because it does not use a predefined set
66 in practice it has been limited to the capabilities defined by
67 terminfo implementations.
69 user-defined capabilities intended for use by termcap applications should
70 be limited to booleans and numbers to avoid running past the 1023 byte
71 limit assumed by termcap implementations and their applications.
72 In particular, providing extended sets of function keys (past the 60
73 numbered keys and the handful of special named keys) is best done using
74 the longer names available using terminfo.
78 The following entry, describing an ANSI-standard terminal, is representative
79 of what a \fBterminfo\fR entry for a modern terminal typically looks like.
83 \s-2ansi|ansi/pc-term compatible with color,
85 colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64,
86 acsc=+\\020\\,\\021-\\030.^Y0\\333`\\004a\\261f\\370g\\361h\\260
87 j\\331k\\277l\\332m\\300n\\305o~p\\304q\\304r\\304s_t\\303
88 u\\264v\\301w\\302x\\263y\\363z\\362{\\343|\\330}\\234~\\376,
89 bel=^G, blink=\\E[5m, bold=\\E[1m, cbt=\\E[Z, clear=\\E[H\\E[J,
90 cr=^M, cub=\\E[%p1%dD, cub1=\\E[D, cud=\\E[%p1%dB, cud1=\\E[B,
91 cuf=\\E[%p1%dC, cuf1=\\E[C, cup=\\E[%i%p1%d;%p2%dH,
92 cuu=\\E[%p1%dA, cuu1=\\E[A, dch=\\E[%p1%dP, dch1=\\E[P,
93 dl=\\E[%p1%dM, dl1=\\E[M, ech=\\E[%p1%dX, ed=\\E[J, el=\\E[K,
94 el1=\\E[1K, home=\\E[H, hpa=\\E[%i%p1%dG, ht=\\E[I, hts=\\EH,
95 ich=\\E[%p1%d@, il=\\E[%p1%dL, il1=\\E[L, ind=^J,
96 indn=\\E[%p1%dS, invis=\\E[8m, kbs=^H, kcbt=\\E[Z, kcub1=\\E[D,
97 kcud1=\\E[B, kcuf1=\\E[C, kcuu1=\\E[A, khome=\\E[H, kich1=\\E[L,
98 mc4=\\E[4i, mc5=\\E[5i, nel=\\r\\E[S, op=\\E[39;49m,
99 rep=%p1%c\\E[%p2%{1}%-%db, rev=\\E[7m, rin=\\E[%p1%dT,
100 rmacs=\\E[10m, rmpch=\\E[10m, rmso=\\E[m, rmul=\\E[m,
101 s0ds=\\E(B, s1ds=\\E)B, s2ds=\\E*B, s3ds=\\E+B,
102 setab=\\E[4%p1%dm, setaf=\\E[3%p1%dm,
103 sgr=\\E[0;10%?%p1%t;7%;
110 sgr0=\\E[0;10m, smacs=\\E[11m, smpch=\\E[11m, smso=\\E[7m,
111 smul=\\E[4m, tbc=\\E[3g, u6=\\E[%i%d;%dR, u7=\\E[6n,
112 u8=\\E[?%[;0123456789]c, u9=\\E[c, vpa=\\E[%i%p1%dd,
116 Entries may continue onto multiple lines by placing white space at
117 the beginning of each line except the first.
118 Comments may be included on lines beginning with \*(``#\*(''.
123 Boolean capabilities which indicate that the terminal has
124 some particular feature,
126 numeric capabilities giving the size of the terminal
127 or the size of particular delays, and
130 capabilities, which give a sequence which can be used to perform particular
133 .SS Types of Capabilities
135 All capabilities have names.
136 For instance, the fact that
137 ANSI-standard terminals have
138 .I "automatic margins"
139 (i.e., an automatic return and line-feed
140 when the end of a line is reached) is indicated by the capability \fBam\fR.
141 Hence the description of ansi includes \fBam\fR.
142 Numeric capabilities are followed by the character \*(``#\*('' and then a positive value.
143 Thus \fBcols\fR, which indicates the number of columns the terminal has,
144 gives the value \*(``80\*('' for ansi.
145 Values for numeric capabilities may be specified in decimal, octal or hexadecimal,
146 using the C programming language conventions (e.g., 255, 0377 and 0xff or 0xFF).
148 Finally, string valued capabilities, such as \fBel\fR (clear to end of line
149 sequence) are given by the two-character code, an \*(``=\*('', and then a string
150 ending at the next following \*(``,\*(''.
152 A number of escape sequences are provided in the string valued capabilities
153 for easy encoding of characters there:
155 Both \fB\eE\fR and \fB\ee\fR
156 map to an \s-1ESCAPE\s0 character,
158 \fB^x\fR maps to a control-x for any appropriate \fIx\fP, and
163 \fB\en\fP, \fB\el\fP, \fB\er\fP, \fB\et\fP, \fB\eb\fP, \fB\ef\fP, and \fB\es\fR
169 \fInewline\fP, \fIline-feed\fP, \fIreturn\fP, \fItab\fP, \fIbackspace\fP, \fIform-feed\fP, and \fIspace\fP,
174 X/Open Curses does not say what \*(``appropriate \fIx\fP\*('' might be.
175 In practice, that is a printable ASCII graphic character.
176 The special case \*(``^?\*('' is interpreted as DEL (127).
177 In all other cases, the character value is AND'd with 0x1f,
178 mapping to ASCII control codes in the range 0 through 31.
180 Other escapes include
182 \fB\e^\fR for \fB^\fR,
184 \fB\e\e\fR for \fB\e\fR,
188 \fB\e:\fR for \fB:\fR,
190 and \fB\e0\fR for null.
192 \fB\e0\fR will produce \e200, which does not terminate a string but behaves
193 as a null character on most terminals, providing CS7 is specified.
196 The reason for this quirk is to maintain binary compatibility of the
197 compiled terminfo files with other implementations,
198 e.g., the SVr4 systems, which document this.
199 Compiled terminfo files use null-terminated strings, with no lengths.
200 Modifying this would require a new binary format,
201 which would not work with other implementations.
203 Finally, characters may be given as three octal digits after a \fB\e\fR.
205 A delay in milliseconds may appear anywhere in a string capability, enclosed in
206 $<..> brackets, as in \fBel\fP=\eEK$<5>,
207 and padding characters are supplied by \fBtputs\fP(3X)
208 to provide this delay.
210 The delay must be a number with at most one decimal
211 place of precision; it may be followed by suffixes \*(``*\*('' or \*(``/\*('' or both.
214 indicates that the padding required is proportional to the number of lines
215 affected by the operation, and the amount given is the per-affected-unit
217 (In the case of insert character, the factor is still the
218 number of \fIlines\fP affected.)
220 Normally, padding is advisory if the device has the \fBxon\fR
221 capability; it is used for cost computation but does not trigger delays.
224 suffix indicates that the padding is mandatory and forces a delay of the given
225 number of milliseconds even on devices for which \fBxon\fR is present to
226 indicate flow control.
228 Sometimes individual capabilities must be commented out.
229 To do this, put a period before the capability name.
230 For example, see the second
232 in the example above.
236 .SS Fetching Compiled Descriptions
238 The \fBncurses\fP library searches for terminal descriptions in several places.
239 It uses only the first description found.
240 The library has a compiled-in list of places to search
241 which can be overridden by environment variables.
242 Before starting to search,
243 \fBncurses\fP eliminates duplicates in its search list.
245 If the environment variable TERMINFO is set, it is interpreted as the pathname
246 of a directory containing the compiled description you are working on.
247 Only that directory is searched.
249 If TERMINFO is not set,
250 \fBncurses\fR will instead look in the directory \fB$HOME/.terminfo\fR
251 for a compiled description.
253 Next, if the environment variable TERMINFO_DIRS is set,
254 \fBncurses\fR will interpret the contents of that variable
255 as a list of colon-separated directories (or database files) to be searched.
257 An empty directory name (i.e., if the variable begins or ends
258 with a colon, or contains adjacent colons)
259 is interpreted as the system location \fI\*d\fR.
261 Finally, \fBncurses\fP searches these compiled-in locations:
264 a list of directories (@TERMINFO_DIRS@), and
266 the system terminfo directory, \fI\*d\fR (the compiled-in default).
268 .SS Preparing Descriptions
270 We now outline how to prepare descriptions of terminals.
271 The most effective way to prepare a terminal description is by imitating
272 the description of a similar terminal in
274 and to build up a description gradually, using partial descriptions
277 or some other screen-oriented program to check that they are correct.
278 Be aware that a very unusual terminal may expose deficiencies in
282 or bugs in the screen-handling code of the test program.
284 To get the padding for insert line right (if the terminal manufacturer
285 did not document it) a severe test is to edit a large file at 9600 baud,
286 delete 16 or so lines from the middle of the screen, then hit the \*(``u\*(''
287 key several times quickly.
288 If the terminal messes up, more padding is usually needed.
289 A similar test can be used for insert character.
291 .SS Basic Capabilities
293 The number of columns on each line for the terminal is given by the
294 \fBcols\fR numeric capability.
295 If the terminal is a \s-1CRT\s0, then the
296 number of lines on the screen is given by the \fBlines\fR capability.
297 If the terminal wraps around to the beginning of the next line when
298 it reaches the right margin, then it should have the \fBam\fR capability.
299 If the terminal can clear its screen, leaving the cursor in the home
300 position, then this is given by the \fBclear\fR string capability.
301 If the terminal overstrikes
302 (rather than clearing a position when a character is struck over)
303 then it should have the \fBos\fR capability.
304 If the terminal is a printing terminal, with no soft copy unit,
310 applies to storage scope terminals, such as \s-1TEKTRONIX\s+1 4010
311 series, as well as hard copy and APL terminals.)
312 If there is a code to move the cursor to the left edge of the current
315 (Normally this will be carriage return, control/M.)
316 If there is a code to produce an audible signal (bell, beep, etc)
320 If there is a code to move the cursor one position to the left
321 (such as backspace) that capability should be given as
323 Similarly, codes to move to the right, up, and down should be
329 These local cursor motions should not alter the text they pass over,
330 for example, you would not normally use \*(``\fBcuf1\fP=\ \*('' because the
331 space would erase the character moved over.
333 A very important point here is that the local cursor motions encoded
336 are undefined at the left and top edges of a \s-1CRT\s0 terminal.
337 Programs should never attempt to backspace around the left edge,
341 and never attempt to go up locally off the top.
342 In order to scroll text up, a program will go to the bottom left corner
343 of the screen and send the
347 To scroll text down, a program goes to the top left corner
348 of the screen and sends the
350 (reverse index) string.
355 are undefined when not on their respective corners of the screen.
357 Parameterized versions of the scrolling sequences are
361 which have the same semantics as
365 except that they take one parameter, and scroll that many lines.
366 They are also undefined except at the appropriate edge of the screen.
368 The \fBam\fR capability tells whether the cursor sticks at the right
369 edge of the screen when text is output, but this does not necessarily
372 from the last column.
373 The only local motion which is defined from the left edge is if
377 from the left edge will move to the right edge of the previous row.
380 is not given, the effect is undefined.
381 This is useful for drawing a box around the edge of the screen, for example.
382 If the terminal has switch selectable automatic margins,
385 file usually assumes that this is on; i.e., \fBam\fR.
386 If the terminal has a command which moves to the first column of the next
387 line, that command can be given as
390 It does not matter if the command clears the remainder of the current line,
391 so if the terminal has no
395 it may still be possible to craft a working
397 out of one or both of them.
399 These capabilities suffice to describe hard-copy and \*(``glass-tty\*('' terminals.
400 Thus the model 33 teletype is described as
406 \s-133\||\|tty33\||\|tty\||\|model 33 teletype,
407 bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,\s+1
412 while the Lear Siegler \s-1ADM-3\s0 is described as
418 \s-1adm3\||\|3\||\|lsi adm3,
419 am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,
420 ind=^J, lines#24,\s+1
425 .SS Parameterized Strings
427 Cursor addressing and other strings requiring parameters
428 in the terminal are described by a
429 parameterized string capability,
430 with \fIprintf\fP-like escapes such as \fI%x\fR in it.
431 For example, to address the cursor, the
433 capability is given, using two parameters:
434 the row and column to address to.
435 (Rows and columns are numbered from zero and refer to the
436 physical screen visible to the user, not to any unseen memory.)
437 If the terminal has memory relative cursor addressing,
438 that can be indicated by
441 The parameter mechanism uses a stack and special \fB%\fP codes
443 Typically a sequence will push one of the
444 parameters onto the stack and then print it in some format.
445 Print (e.g., \*(``%d\*('') is a special case.
446 Other operations, including \*(``%t\*('' pop their operand from the stack.
447 It is noted that more complex operations are often necessary,
448 e.g., in the \fBsgr\fP string.
450 The \fB%\fR encodings have the following meanings:
456 \fB%\fP\fI[[\fP:\fI]flags][width[.precision]][\fP\fBdoxXs\fP\fI]\fP
457 as in \fBprintf\fP(3), flags are \fI[\-+#]\fP and \fIspace\fP.
458 Use a \*(``:\*('' to allow the next character to be a \*(``\-\*('' flag,
459 avoiding interpreting \*(``%\-\*('' as an operator.
462 print \fIpop()\fP like %c in \fBprintf\fP
465 print \fIpop()\fP like %s in \fBprintf\fP
468 push \fIi\fP'th parameter
471 set dynamic variable \fI[a\-z]\fP to \fIpop()\fP
473 \fB%g\fP\fI[a\-z]/\fP
474 get dynamic variable \fI[a\-z]\fP and push it
477 set static variable \fI[a\-z]\fP to \fIpop()\fP
480 get static variable \fI[a\-z]\fP and push it
482 The terms \*(``static\*('' and \*(``dynamic\*('' are misleading.
483 Historically, these are simply two different sets of variables,
484 whose values are not reset between calls to \fBtparm\fP(3X).
485 However, that fact is not documented in other implementations.
486 Relying on it will adversely impact portability to other implementations:
489 SVr2 curses supported \fIdynamic\fP variables.
490 Those are set only by a \fB%P\fP operator.
491 A \fB%g\fP for a given variable without first setting it with \fB%P\fP
492 will give unpredictable results, because dynamic variables are
493 an uninitialized local array on the stack in the \fBtparm\fP function.
495 SVr3.2 curses supported \fIstatic\fP variables.
496 Those are an array in the \fBTERMINAL\fP
497 structure (declared in \fBterm.h\fP),
498 and are zeroed automatically when the \fBsetupterm\fP function
501 SVr4 curses made no further improvements
502 to the \fIdynamic/static\fP variable feature.
504 Solaris XPG4 curses does not distinguish between \fIdynamic\fP and
505 \fIstatic\fP variables.
507 Like SVr4 curses, XPG4 curses does not initialize these explicitly.
509 Before version 6.3, ncurses stores both \fIdynamic\fP and \fIstatic\fP
510 variables in persistent storage, initialized to zeros.
512 Beginning with version 6.3, ncurses stores \fIstatic\fP and \fIdynamic\fP
513 variables in the same manner as SVr4.
514 Unlike other implementations, ncurses zeros dynamic variables
515 before the first \fB%g\fP or \fB%P\fP operator.
518 \fB%\(aq\fP\fIc\fP\fB\(aq\fP
519 char constant \fIc\fP
521 \fB%{\fP\fInn\fP\fB}\fP
522 integer constant \fInn\fP
527 \fB%+\fP, \fB%\-\fP, \fB%*\fP, \fB%/\fP, \fB%m\fP
528 arithmetic (%m is \fImod\fP): \fIpush(pop() op pop())\fP
530 \fB%&\fP, \fB%|\fP, \fB%^\fP
531 bit operations (AND, OR and exclusive-OR): \fIpush(pop() op pop())\fP
533 \fB%=\fP, \fB%>\fP, \fB%<\fP
534 logical operations: \fIpush(pop() op pop())\fP
537 logical AND and OR operations (for conditionals)
540 unary operations (logical and bit complement): \fIpush(op pop())\fP
543 add 1 to first two parameters (for ANSI terminals)
545 \fB%?\fP \fIexpr\fP \fB%t\fP \fIthenpart\fP \fB%e\fP \fIelsepart\fP \fB%;\fP
546 This forms an if-then-else.
547 The \fB%e\fP \fIelsepart\fP is optional.
548 Usually the \fB%?\fP \fIexpr\fP part pushes a value onto the stack,
549 and \fB%t\fP pops it from the stack, testing if it is nonzero (true).
550 If it is zero (false), control passes to the \fB%e\fP (else) part.
552 It is possible to form else-if's a la Algol 68:
554 \fB%?\fP c\d1\u \fB%t\fP b\d1\u \fB%e\fP c\d2\u \fB%t\fP b\d2\u \fB%e\fP c\d3\u \fB%t\fP b\d3\u \fB%e\fP c\d4\u \fB%t\fP b\d4\u \fB%e\fP \fB%;\fP
557 where c\di\u are conditions, b\di\u are bodies.
559 Use the \fB\-f\fP option of \fB@TIC@\fP or \fB@INFOCMP@\fP to see
560 the structure of if-then-else's.
561 Some strings, e.g., \fBsgr\fP can be very complicated when written
563 The \fB\-f\fP option splits the string into lines with the parts indented.
565 Binary operations are in postfix form with the operands in the usual order.
566 That is, to get x\-5 one would use \*(``%gx%{5}%\-\*(''.
567 \fB%P\fP and \fB%g\fP variables are
568 persistent across escape-string evaluations.
570 Consider the HP2645, which, to get to row 3 and column 12, needs
571 to be sent \eE&a12c03Y padded for 6 milliseconds.
573 of the rows and columns is inverted here, and that the row and column
574 are printed as two digits.
575 Thus its \fBcup\fR capability is \*(``cup=6\eE&%p2%2dc%p1%2dY\*(''.
577 The Microterm \s-1ACT-IV\s0 needs the current row and column sent
578 preceded by a \fB^T\fR, with the row and column simply encoded in binary,
579 \*(``cup=^T%p1%c%p2%c\*(''.
580 Terminals which use \*(``%c\*('' need to be able to
581 backspace the cursor (\fBcub1\fR),
582 and to move the cursor up one line on the screen (\fBcuu1\fR).
583 This is necessary because it is not always safe to transmit \fB\en\fR
584 \fB^D\fR and \fB\er\fR, as the system may change or discard them.
585 (The library routines dealing with terminfo set tty modes so that
586 tabs are never expanded, so \et is safe to send.
587 This turns out to be essential for the Ann Arbor 4080.)
589 A final example is the \s-1LSI ADM\s0-3a, which uses row and column
590 offset by a blank character, thus \*(``cup=\eE=%p1%\(aq \(aq%+%c%p2%\(aq \(aq%+%c\*(''.
591 After sending \*(``\eE=\*('', this pushes the first parameter, pushes the
592 ASCII value for a space (32), adds them (pushing the sum on the stack
593 in place of the two previous values) and outputs that value as a character.
594 Then the same is done for the second parameter.
595 More complex arithmetic is possible using the stack.
599 If the terminal has a fast way to home the cursor
600 (to very upper left corner of screen) then this can be given as
601 \fBhome\fR; similarly a fast way of getting to the lower left-hand corner
602 can be given as \fBll\fR; this may involve going up with \fBcuu1\fR
603 from the home position,
604 but a program should never do this itself (unless \fBll\fR does) because it
605 can make no assumption about the effect of moving up from the home position.
606 Note that the home position is the same as addressing to (0,0):
607 to the top left corner of the screen, not of memory.
608 (Thus, the \eEH sequence on HP terminals cannot be used for
611 If the terminal has row or column absolute cursor addressing,
612 these can be given as single parameter capabilities
614 (horizontal position absolute)
617 (vertical position absolute).
618 Sometimes these are shorter than the more general two parameter
619 sequence (as with the hp2645) and can be used in preference to
621 If there are parameterized local motions (e.g., move
623 spaces to the right) these can be given as
629 with a single parameter indicating how many spaces to move.
630 These are primarily useful if the terminal does not have
632 such as the \s-1TEKTRONIX\s+1 4025.
634 If the terminal needs to be in a special mode when running
635 a program that uses these capabilities,
636 the codes to enter and exit this mode can be given as \fBsmcup\fR and \fBrmcup\fR.
637 This arises, for example, from terminals like the Concept with more than
639 If the terminal has only memory relative cursor addressing and not screen
640 relative cursor addressing, a one screen-sized window must be fixed into
641 the terminal for cursor addressing to work properly.
642 This is also used for the \s-1TEKTRONIX\s+1 4025,
645 sets the command character to be the one used by terminfo.
646 If the \fBsmcup\fP sequence will not restore the screen after an
647 \fBrmcup\fP sequence is output (to the state prior to outputting
648 \fBrmcup\fP), specify \fBnrrmc\fP.
651 SVr4 (and X/Open Curses)
652 list several string capabilities for setting margins.
653 Two were intended for use with terminals,
654 and another six were intended for use with printers.
656 The two terminal capabilities assume that the terminal may have
657 the capability of setting the left and/or right margin at the current
658 cursor column position.
660 The printer capabilities assume that the printer may have
661 two types of capability:
664 the ability to set a top and/or bottom margin using the current
667 parameterized capabilities for setting the top, bottom, left, right margins
668 given the number of rows or columns.
672 In practice, the categorization into \*(``terminal\*('' and \*(``printer\*(''
675 The AT&T SVr4 terminal database uses \fBsmgl\fP four times,
678 Three of the four are printers.
679 They lack the ability to set left/right margins by specifying the column.
681 Other (non-AT&T) terminals may support margins
682 but using different assumptions from AT&T.
684 For instance, the DEC VT420 supports left/right margins,
685 but only using a column parameter.
686 As an added complication, the VT420 uses two settings to fully enable
687 left/right margins (left/right margin mode, and origin mode).
688 The former enables the margins, which causes printed text
689 to wrap within margins, but the latter is needed to prevent
690 cursor-addressing outside those margins.
692 Both DEC VT420 left/right margins are set with a single control sequence.
693 If either is omitted, the corresponding margin is set to the left or
694 right edge of the display (rather than leaving the margin unmodified).
696 These are the margin-related capabilities:
702 \fBName Description\fP
703 smgl Set left margin at current column
704 smgr Set right margin at current column
705 smgb Set bottom margin at current line
706 smgt Set top margin at current line
707 smgbp Set bottom margin at line \fIN\fP
708 smglp Set left margin at column \fIN\fP
709 smgrp Set right margin at column \fIN\fP
710 smgtp Set top margin at line \fIN\fP
713 When writing an application that
714 uses these string capabilities,
715 the pairs should be first checked to see
716 if each capability in the pair is set or only one is set:
718 If both \fBsmglp\fP and \fBsmgrp\fP are set,
719 each is used with a single argument, \fIN\fP,
720 that gives the column number of the left and right margin, respectively.
722 If both \fBsmgtp\fP and \fBsmgbp\fP are set,
723 each is used to set the top and bottom margin,
727 \fBsmgtp\fP is used with a single argument, \fIN\fP,
728 the line number of the top margin.
730 \fBsmgbp\fP is used with two arguments, \fIN\fP and \fIM\fP,
731 that give the line number of the bottom margin,
732 the first counting from the top of the
733 page and the second counting from the bottom.
734 This accommodates the two styles of specifying
735 the bottom margin in different manufacturers' printers.
738 When designing a terminfo entry for a
739 printer that has a settable bottom margin,
740 only the first or second argument should be used, depending on the printer.
741 When developing an application that uses \fBsmgbp\fP to set the bottom margin,
742 both arguments must be given.
744 Conversely, when only one capability in the pair is set:
746 If only one of \fBsmglp\fP and \fBsmgrp\fP is set,
747 then it is used with two arguments,
748 the column number of the left and right margins, in that order.
750 Likewise, if only one of \fBsmgtp\fP and \fBsmgbp\fP is set, then it
751 is used with two arguments that give the top and bottom margins,
752 in that order, counting from the top of the page.
754 When designing a terminfo entry for a printer that requires setting both
755 left and right or top and bottom margins simultaneously,
756 only one capability in the pairs
757 \fBsmglp\fP and \fBsmgrp\fP or
758 \fBsmgtp\fP and \fBsmgbp\fP should be defined,
759 leaving the other unset.
761 When setting margins, the line- and column-values are zero-based.
763 The \fBmgc\fP string capability should be defined.
764 Applications such as \fBtabs\fP(1) rely upon this to reset all margins.
768 If the terminal can clear from the current position to the end of the
769 line, leaving the cursor where it is, this should be given as \fBel\fR.
770 If the terminal can clear from the beginning of the line to the current
771 position inclusive, leaving
772 the cursor where it is, this should be given as \fBel1\fP.
773 If the terminal can clear from the current position to the end of the
774 display, then this should be given as \fBed\fR.
775 \fBEd\fR is only defined from the first column of a line.
776 (Thus, it can be simulated by a request to delete a large number of lines,
782 .SS Insert/delete line and vertical motions
784 If the terminal can open a new blank line before the line where the cursor
785 is, this should be given as \fBil1\fR; this is done only from the first
787 The cursor must then appear on the newly blank line.
788 If the terminal can delete the line which the cursor is on, then this
789 should be given as \fBdl1\fR; this is done only from the first position on
790 the line to be deleted.
795 which take a single parameter and insert or delete that many lines can
801 If the terminal has a settable scrolling region (like the vt100)
802 the command to set this can be described with the
804 capability, which takes two parameters:
805 the top and bottom lines of the scrolling region.
806 The cursor position is, alas, undefined after using this command.
808 It is possible to get the effect of insert or delete line using
810 on a properly chosen region; the
814 (save and restore cursor) commands may be useful for ensuring that
815 your synthesized insert/delete string does not move the cursor.
816 (Note that the \fBncurses\fR(3X) library does this synthesis
817 automatically, so you need not compose insert/delete strings for
818 an entry with \fBcsr\fR).
820 Yet another way to construct insert and delete might be to use a combination of
821 index with the memory-lock feature found on some terminals (like the HP\-700/90
822 series, which however also has insert/delete).
824 Inserting lines at the top or bottom of the screen can also be
829 on many terminals without a true insert/delete line,
830 and is often faster even on terminals with those features.
832 The boolean \fBnon_dest_scroll_region\fR should be set if each scrolling
833 window is effectively a view port on a screen-sized canvas.
835 this capability, create a scrolling region in the middle of the screen,
836 write something to the bottom line, move the cursor to the top of the region,
837 and do \fBri\fR followed by \fBdl1\fR or \fBind\fR.
839 off the bottom of the region by the \fBri\fR re-appears, then scrolling
841 System V and XSI Curses expect that \fBind\fR, \fBri\fR,
842 \fBindn\fR, and \fBrin\fR will simulate destructive scrolling; their
843 documentation cautions you not to define \fBcsr\fR unless this is true.
844 This \fBcurses\fR implementation is more liberal and will do explicit erases
845 after scrolling if \fBndsrc\fR is defined.
847 If the terminal has the ability to define a window as part of
848 memory, which all commands affect,
849 it should be given as the parameterized string
851 The four parameters are the starting and ending lines in memory
852 and the starting and ending columns in memory, in that order.
854 If the terminal can retain display memory above, then the
855 \fBda\fR capability should be given; if display memory can be retained
856 below, then \fBdb\fR should be given.
858 that deleting a line or scrolling may bring non-blank lines up from below
859 or that scrolling back with \fBri\fR may bring down non-blank lines.
861 .SS Insert/Delete Character
863 There are two basic kinds of intelligent terminals with respect to
864 insert/delete character which can be described using
866 The most common insert/delete character operations affect only the characters
867 on the current line and shift characters off the end of the line rigidly.
868 Other terminals, such as the Concept 100 and the Perkin Elmer Owl, make
869 a distinction between typed and untyped blanks on the screen, shifting
870 upon an insert or delete only to an untyped blank on the screen which is
871 either eliminated, or expanded to two untyped blanks.
873 You can determine the
874 kind of terminal you have by clearing the screen and then typing
875 text separated by cursor motions.
876 Type \*(``abc\ \ \ \ def\*('' using local
877 cursor motions (not spaces) between the \*(``abc\*('' and the \*(``def\*(''.
878 Then position the cursor before the \*(``abc\*('' and put the terminal in insert
880 If typing characters causes the rest of the line to shift
881 rigidly and characters to fall off the end, then your terminal does
882 not distinguish between blanks and untyped positions.
884 shifts over to the \*(``def\*('' which then move together around the end of the
885 current line and onto the next as you insert, you have the second type of
886 terminal, and should give the capability \fBin\fR, which stands for
887 \*(``insert null\*(''.
889 While these are two logically separate attributes (one line versus multi-line
890 insert mode, and special treatment of untyped spaces) we have seen no
891 terminals whose insert mode cannot be described with the single attribute.
893 Terminfo can describe both terminals which have an insert mode, and terminals
894 which send a simple sequence to open a blank position on the current line.
895 Give as \fBsmir\fR the sequence to get into insert mode.
896 Give as \fBrmir\fR the sequence to leave insert mode.
897 Now give as \fBich1\fR any sequence needed to be sent just before sending
898 the character to be inserted.
899 Most terminals with a true insert mode
900 will not give \fBich1\fR; terminals which send a sequence to open a screen
901 position should give it here.
903 If your terminal has both, insert mode is usually preferable to \fBich1\fR.
904 Technically, you should not give both unless the terminal actually requires
905 both to be used in combination.
906 Accordingly, some non-curses applications get
907 confused if both are present; the symptom is doubled characters in an update
909 This requirement is now rare; most \fBich\fR sequences do not
910 require previous smir, and most smir insert modes do not require \fBich1\fR
911 before each character.
912 Therefore, the new \fBcurses\fR actually assumes this
913 is the case and uses either \fBrmir\fR/\fBsmir\fR or \fBich\fR/\fBich1\fR as
914 appropriate (but not both).
915 If you have to write an entry to be used under
916 new curses for a terminal old enough to need both, include the
917 \fBrmir\fR/\fBsmir\fR sequences in \fBich1\fR.
919 If post insert padding is needed, give this as a number of milliseconds
920 in \fBip\fR (a string option).
921 Any other sequence which may need to be
922 sent after an insert of a single character may also be given in \fBip\fR.
923 If your terminal needs both to be placed into an \*(``insert mode\*('' and
924 a special code to precede each inserted character, then both
928 can be given, and both will be used.
931 capability, with one parameter,
933 will repeat the effects of
938 If padding is necessary between characters typed while not
939 in insert mode, give this as a number of milliseconds padding in \fBrmp\fP.
941 It is occasionally necessary to move around while in insert mode
942 to delete characters on the same line (e.g., if there is a tab after
943 the insertion position).
944 If your terminal allows motion while in
945 insert mode you can give the capability \fBmir\fR to speed up inserting
947 Omitting \fBmir\fR will affect only speed.
949 (notably Datamedia's) must not have \fBmir\fR because of the way their
952 Finally, you can specify
954 to delete a single character,
960 and delete mode by giving \fBsmdc\fR and \fBrmdc\fR
961 to enter and exit delete mode (any mode the terminal needs to be placed
968 characters (equivalent to outputting
970 blanks without moving the cursor)
975 .SS "Highlighting, Underlining, and Visible Bells"
977 If your terminal has one or more kinds of display attributes,
978 these can be represented in a number of different ways.
979 You should choose one display form as
981 representing a good, high contrast, easy-on-the-eyes,
982 format for highlighting error messages and other attention getters.
983 (If you have a choice, reverse video plus half-bright is good,
984 or reverse video alone.)
985 The sequences to enter and exit standout mode
986 are given as \fBsmso\fR and \fBrmso\fR, respectively.
987 If the code to change into or out of standout
988 mode leaves one or even two blank spaces on the screen,
989 as the TVI 912 and Teleray 1061 do,
990 then \fBxmc\fR should be given to tell how many spaces are left.
992 Codes to begin underlining and end underlining can be given as \fBsmul\fR
993 and \fBrmul\fR respectively.
994 If the terminal has a code to underline the current character and move
995 the cursor one space to the right,
996 such as the Microterm Mime,
997 this can be given as \fBuc\fR.
999 Other capabilities to enter various highlighting modes include
1003 (bold or extra bright)
1005 (dim or half-bright)
1007 (blanking or invisible text)
1017 (enter alternate character set mode)
1020 (exit alternate character set mode).
1021 Turning on any of these modes singly may or may not turn off other modes.
1023 If there is a sequence to set arbitrary combinations of modes,
1024 this should be given as
1027 taking 9 parameters.
1028 Each parameter is either 0 or nonzero, as the corresponding attribute is on or off.
1029 The 9 parameters are, in order:
1030 standout, underline, reverse, blink, dim, bold, blank, protect, alternate
1032 Not all modes need be supported by
1034 only those for which corresponding separate attribute commands exist.
1036 For example, the DEC vt220 supports most of the modes:
1043 \fBtparm parameter attribute escape sequence\fP
1046 p1 standout \\E[0;1;7m
1047 p2 underline \\E[0;4m
1050 p5 dim not available
1054 p9 altcharset ^O (off) ^N (on)
1057 We begin each escape sequence by turning off any existing modes, since
1058 there is no quick way to determine whether they are active.
1059 Standout is set up to be the combination of reverse and bold.
1060 The vt220 terminal has a protect mode,
1061 though it is not commonly used in sgr
1062 because it protects characters on the screen from the host's erasures.
1063 The altcharset mode also is different in that it is either ^O or ^N,
1064 depending on whether it is off or on.
1065 If all modes are turned on, the resulting sequence is \\E[0;1;4;5;7;8m^N.
1067 Some sequences are common to different modes.
1068 For example, ;7 is output when either p1 or p3 is true, that is, if
1069 either standout or reverse modes are turned on.
1071 Writing out the above sequences, along with their dependencies yields
1079 \fBsequence when to output terminfo translation\fP
1083 ;1 if p1 or p6 %?%p1%p6%|%t;1%;
1084 ;4 if p2 %?%p2%|%t;4%;
1085 ;5 if p4 %?%p4%|%t;5%;
1086 ;7 if p1 or p3 %?%p1%p3%|%t;7%;
1087 ;8 if p7 %?%p7%|%t;8%;
1089 ^N or ^O if p9 ^N, else ^O %?%p9%t^N%e^O%;
1093 Putting this all together into the sgr sequence gives:
1097 sgr=\\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p4%t;5%;
1098 %?%p1%p3%|%t;7%;%?%p7%t;8%;m%?%p9%t\\016%e\\017%;,
1102 Remember that if you specify sgr, you must also specify sgr0.
1103 Also, some implementations rely on sgr being given if sgr0 is,
1104 Not all terminfo entries necessarily have an sgr string, however.
1105 Many terminfo entries are derived from termcap entries
1106 which have no sgr string.
1107 The only drawback to adding an sgr string is that termcap also
1108 assumes that sgr0 does not exit alternate character set mode.
1110 Terminals with the \*(``magic cookie\*('' glitch
1112 deposit special \*(``cookies\*('' when they receive mode-setting sequences,
1113 which affect the display algorithm rather than having extra bits for
1115 Some terminals, such as the HP 2621, automatically leave standout
1116 mode when they move to a new line or the cursor is addressed.
1117 Programs using standout mode should exit standout mode before
1118 moving the cursor or sending a newline,
1121 capability, asserting that it is safe to move in standout mode, is present.
1124 a way of flashing the screen to indicate an error quietly (a bell replacement)
1125 then this can be given as \fBflash\fR; it must not move the cursor.
1127 If the cursor needs to be made more visible than normal when it is
1128 not on the bottom line (to make, for example, a non-blinking underline into an
1129 easier to find block or blinking underline)
1130 give this sequence as
1132 If there is a way to make the cursor completely invisible, give that as
1136 should be given which undoes the effects of both of these modes.
1138 If your terminal correctly generates underlined characters
1139 (with no special codes needed)
1140 even though it does not overstrike,
1141 then you should give the capability \fBul\fR.
1142 If a character overstriking another leaves both characters on the screen,
1143 specify the capability \fBos\fP.
1144 If overstrikes are erasable with a blank,
1145 then this should be indicated by giving \fBeo\fR.
1147 .SS Keypad and Function Keys
1149 If the terminal has a keypad that transmits codes when the keys are pressed,
1150 this information can be given.
1151 Note that it is not possible to handle
1152 terminals where the keypad only works in local (this applies, for example,
1153 to the unshifted HP 2621 keys).
1154 If the keypad can be set to transmit or not transmit,
1155 give these codes as \fBsmkx\fR and \fBrmkx\fR.
1156 Otherwise the keypad is assumed to always transmit.
1158 The codes sent by the left arrow, right arrow, up arrow, down arrow,
1159 and home keys can be given as
1160 \fBkcub1, kcuf1, kcuu1, kcud1, \fRand\fB khome\fR respectively.
1161 If there are function keys such as f0, f1, ..., f10, the codes they send
1162 can be given as \fBkf0, kf1, ..., kf10\fR.
1163 If these keys have labels other than the default f0 through f10, the labels
1164 can be given as \fBlf0, lf1, ..., lf10\fR.
1166 The codes transmitted by certain other special keys can be given:
1178 (clear the tab stop in this column),
1181 (clear screen or erase key),
1193 (clear to end of line),
1196 (clear to end of screen),
1199 (insert character or enter insert mode),
1211 (scroll forward/down),
1214 (scroll backward/up),
1217 (set a tab stop in this column).
1219 In addition, if the keypad has a 3 by 3 array of keys including the four
1220 arrow keys, the other five keys can be given as
1227 These keys are useful when the effects of a 3 by 3 directional pad are needed.
1229 Strings to program function keys can be given as
1234 A string to program screen labels should be specified as \fBpln\fP.
1235 Each of these strings takes two parameters: the function key number to
1236 program (from 0 to 10) and the string to program it with.
1237 Function key numbers out of this range may program undefined keys in
1238 a terminal dependent manner.
1239 The difference between the capabilities is that
1241 causes pressing the given key to be the same as the user typing the
1244 causes the string to be executed by the terminal in local; and
1246 causes the string to be transmitted to the computer.
1248 The capabilities \fBnlab\fP, \fBlw\fP and \fBlh\fP
1249 define the number of programmable
1250 screen labels and their width and height.
1251 If there are commands to turn the labels on and off,
1252 give them in \fBsmln\fP and \fBrmln\fP.
1253 \fBsmln\fP is normally output after one or more pln
1254 sequences to make sure that the change becomes visible.
1256 .SS Tabs and Initialization
1258 A few capabilities are used only for tabs:
1260 If the terminal has hardware tabs, the command to advance to the next
1261 tab stop can be given as
1263 (usually control/I).
1265 A \*(``back-tab\*('' command which moves leftward to the preceding tab stop can
1269 By convention, if the teletype modes indicate that tabs are being
1270 expanded by the computer rather than being sent to the terminal,
1271 programs should not use
1275 even if they are present, since the user may not have the tab stops
1278 If the terminal has hardware tabs which are initially set every
1280 spaces when the terminal is powered up,
1281 the numeric parameter
1283 is given, showing the number of spaces the tabs are set to.
1285 The \fBit\fP capability is normally used by the \fB@TSET@\fP
1286 command to determine whether to set the mode for hardware tab expansion,
1287 and whether to set the tab stops.
1288 If the terminal has tab stops that can be saved in non-volatile memory,
1289 the terminfo description can assume that they are properly set.
1298 initialization strings for the terminal,
1301 the path name of a program to be run to initialize the terminal,
1303 and \fBif\fR, the name of a file containing long initialization strings.
1305 These strings are expected to set the terminal into modes consistent
1306 with the rest of the terminfo description.
1307 They are normally sent to the terminal, by the
1309 option of the \fB@TPUT@\fP program, each time the user logs in.
1310 They will be printed in the following order:
1322 set the margins using
1325 \fBsmglp\fP and \fBsmgrp\fP or
1327 \fBsmgl\fP and \fBsmgr\fP
1341 Most initialization is done with
1343 Special terminal modes can be set up without duplicating strings
1344 by putting the common sequences in
1346 and special cases in
1351 A set of sequences that does a harder reset from a totally unknown state
1365 These strings are output
1366 by \fIreset\fP option of \fB@TPUT@\fP,
1367 or by the \fB@RESET@\fP program
1368 (an alias of \fB@TSET@\fP),
1369 which is used when the terminal gets into a wedged state.
1370 Commands are normally placed in
1376 only if they produce annoying effects on the screen and are not
1377 necessary when logging in.
1378 For example, the command to set the vt100 into 80-column mode would
1381 but it causes an annoying glitch of the screen and is not normally
1382 needed since the terminal is usually already in 80-column mode.
1384 The \fB@RESET@\fP program writes strings including
1386 etc., in the same order as the
1399 reset capability strings are missing,
1400 the \fB@RESET@\fP program
1401 falls back upon the corresponding initialization capability string.
1403 If there are commands to set and clear tab stops, they can be given as
1405 (clear all tab stops)
1408 (set a tab stop in the current column of every row).
1409 If a more complex sequence is needed to set the tabs than can be
1410 described by this, the sequence can be placed in
1415 The \fB@TPUT@ reset\fP command uses the same capability strings
1416 as the \fB@RESET@\fP command,
1417 although the two programs (\fB@TPUT@\fP and \fB@RESET@\fP)
1418 provide different command-line options.
1420 In practice, these terminfo capabilities are not often used in
1421 initialization of tabs
1422 (though they are required for the \fB@TABS@\fP program):
1424 Almost all hardware terminals (at least those which supported tabs)
1425 initialized those to every \fIeight\fP columns:
1427 The only exception was the AT&T 2300 series,
1428 which set tabs to every \fIfive\fP columns.
1430 In particular, developers of the hardware terminals which are commonly used
1431 as models for modern terminal emulators provided documentation demonstrating
1432 that \fIeight\fP columns were the standard.
1434 Because of this, the terminal initialization programs
1435 \fB@TPUT@\fP and \fB@TSET@\fP
1437 \fBtbc\fP (\fBclear_all_tabs\fP) and
1438 \fBhts\fP (\fBset_tab\fP) capabilities directly
1439 only when the \fBit\fP (\fBinit_tabs\fP) capability
1440 is set to a value other than \fIeight\fP.
1441 .SS Delays and Padding
1443 Many older and slower terminals do not support either XON/XOFF or DTR
1444 handshaking, including hard copy terminals and some very archaic CRTs
1445 (including, for example, DEC VT100s).
1446 These may require padding characters
1447 after certain cursor motions and screen changes.
1449 If the terminal uses xon/xoff handshaking for flow control (that is,
1450 it automatically emits ^S back to the host when its input buffers are
1453 This capability suppresses the emission of padding.
1455 for memory-mapped console devices effectively that do not have a speed limit.
1456 Padding information should still be included so that routines can
1457 make better decisions about relative costs, but actual pad characters will
1460 If \fBpb\fR (padding baud rate) is given, padding is suppressed at baud rates
1461 below the value of \fBpb\fR.
1462 If the entry has no padding baud rate, then
1463 whether padding is emitted or not is completely controlled by \fBxon\fR.
1465 If the terminal requires other than a null (zero) character as a pad,
1466 then this can be given as \fBpad\fR.
1467 Only the first character of the
1472 Some terminals have an extra \*(``status line\*('' which is not normally used by
1473 software (and thus not counted in the terminal's \fBlines\fR capability).
1475 The simplest case is a status line which is cursor-addressable but not
1476 part of the main scrolling region on the screen; the Heathkit H19 has
1477 a status line of this kind, as would a 24-line VT100 with a 23-line
1478 scrolling region set up on initialization.
1479 This situation is indicated
1480 by the \fBhs\fR capability.
1482 Some terminals with status lines need special sequences to access the
1484 These may be expressed as a string with single parameter
1485 \fBtsl\fR which takes the cursor to a given zero-origin column on the
1487 The capability \fBfsl\fR must return to the main-screen
1488 cursor positions before the last \fBtsl\fR.
1489 You may need to embed the
1490 string values of \fBsc\fR (save cursor) and \fBrc\fR (restore cursor)
1491 in \fBtsl\fR and \fBfsl\fR to accomplish this.
1493 The status line is normally assumed to be the same width as the width
1495 If this is untrue, you can specify it with the numeric
1496 capability \fBwsl\fR.
1498 A command to erase or blank the status line may be specified as \fBdsl\fR.
1500 The boolean capability \fBeslok\fR specifies that escape sequences, tabs,
1501 etc., work ordinarily in the status line.
1503 The \fBncurses\fR implementation does not yet use any of these capabilities.
1504 They are documented here in case they ever become important.
1508 Many terminals have alternate character sets useful for forms-drawing.
1509 Terminfo and \fBcurses\fR have built-in support
1510 for most of the drawing characters
1511 supported by the VT100, with some characters from the AT&T 4410v1 added.
1512 This alternate character set may be specified by the \fBacsc\fR capability.
1519 lw25 lw10 lw6 lw6 lw6.
1521 \fBGlyph ACS Ascii acsc acsc\fR
1522 \fBName Name Default Char Value\fR
1523 arrow pointing right ACS_RARROW > + 0x2b
1524 arrow pointing left ACS_LARROW < , 0x2c
1525 arrow pointing up ACS_UARROW ^ \- 0x2d
1526 arrow pointing down ACS_DARROW v . 0x2e
1527 solid square block ACS_BLOCK # 0 0x30
1528 diamond ACS_DIAMOND + ` 0x60
1529 checker board (stipple) ACS_CKBOARD : a 0x61
1530 degree symbol ACS_DEGREE \e f 0x66
1531 plus/minus ACS_PLMINUS # g 0x67
1532 board of squares ACS_BOARD # h 0x68
1533 lantern symbol ACS_LANTERN # i 0x69
1534 lower right corner ACS_LRCORNER + j 0x6a
1535 upper right corner ACS_URCORNER + k 0x6b
1536 upper left corner ACS_ULCORNER + l 0x6c
1537 lower left corner ACS_LLCORNER + m 0x6d
1538 large plus or crossover ACS_PLUS + n 0x6e
1539 scan line 1 ACS_S1 ~ o 0x6f
1540 scan line 3 ACS_S3 \- p 0x70
1541 horizontal line ACS_HLINE \- q 0x71
1542 scan line 7 ACS_S7 \- r 0x72
1543 scan line 9 ACS_S9 \&_ s 0x73
1544 tee pointing right ACS_LTEE + t 0x74
1545 tee pointing left ACS_RTEE + u 0x75
1546 tee pointing up ACS_BTEE + v 0x76
1547 tee pointing down ACS_TTEE + w 0x77
1548 vertical line ACS_VLINE | x 0x78
1549 less-than-or-equal-to ACS_LEQUAL < y 0x79
1550 greater-than-or-equal-to ACS_GEQUAL > z 0x7a
1551 greek pi ACS_PI * { 0x7b
1552 not-equal ACS_NEQUAL ! | 0x7c
1553 UK pound sign ACS_STERLING f } 0x7d
1554 bullet ACS_BULLET o ~ 0x7e
1557 A few notes apply to the table itself:
1559 X/Open Curses incorrectly states that the mapping for \fIlantern\fP is
1560 uppercase \*(``I\*('' although Unix implementations use the
1561 lowercase \*(``i\*('' mapping.
1563 The DEC VT100 implemented graphics using the alternate character set
1564 feature, temporarily switching \fImodes\fP and sending characters
1565 in the range 0x60 (96) to 0x7e (126)
1566 (the \fBacsc Value\fP column in the table).
1568 The AT&T terminal added graphics characters outside that range.
1570 Some of the characters within the range do not match the VT100;
1571 presumably they were used in the AT&T terminal:
1572 \fIboard of squares\fP replaces the VT100 \fInewline\fP symbol, while
1573 \fIlantern symbol\fP replaces the VT100 \fIvertical tab\fP symbol.
1574 The other VT100 symbols for control characters (\fIhorizontal tab\fP,
1575 \fIcarriage return\fP and \fIline-feed\fP) are not (re)used in curses.
1577 The best way to define a new device's graphics set is to add a column
1578 to a copy of this table for your terminal, giving the character which
1579 (when emitted between \fBsmacs\fR/\fBrmacs\fR switches) will be rendered
1580 as the corresponding graphic.
1581 Then read off the VT100/your terminal
1582 character pairs right to left in sequence; these become the ACSC string.
1586 The curses library functions \fBinit_pair\fP and \fBinit_color\fP
1587 manipulate the \fIcolor pairs\fP and \fIcolor values\fP discussed in this
1589 (see \fBcurs_color\fP(3X) for details on these and related functions).
1591 Most color terminals are either \*(``Tektronix-like\*('' or \*(``HP-like\*('':
1594 terminals have a predefined set of \fIN\fP colors
1595 (where \fIN\fP is usually 8),
1597 character-cell foreground and background characters independently, mixing them
1598 into \fIN\fP\ *\ \fIN\fP color-pairs.
1600 On HP-like terminals, the user must set each color
1601 pair up separately (foreground and background are not independently settable).
1602 Up to \fIM\fP color-pairs may be set up from 2*\fIM\fP different colors.
1603 ANSI-compatible terminals are Tektronix-like.
1605 Some basic color capabilities are independent of the color method.
1607 capabilities \fBcolors\fR and \fBpairs\fR specify the maximum numbers of colors
1608 and color-pairs that can be displayed simultaneously.
1609 The \fBop\fR (original
1610 pair) string resets foreground and background colors to their default values
1612 The \fBoc\fR string resets all colors or color-pairs to
1613 their default values for the terminal.
1614 Some terminals (including many PC
1615 terminal emulators) erase screen areas with the current background color rather
1616 than the power-up default background; these should have the boolean capability
1619 While the curses library works with \fIcolor pairs\fP
1620 (reflecting the inability of some devices to set foreground
1621 and background colors independently),
1622 there are separate capabilities for setting these features:
1624 To change the current foreground or background color on a Tektronix-type
1625 terminal, use \fBsetaf\fR (set ANSI foreground) and \fBsetab\fR (set ANSI
1626 background) or \fBsetf\fR (set foreground) and \fBsetb\fR (set background).
1627 These take one parameter, the color number.
1628 The SVr4 documentation describes
1629 only \fBsetaf\fR/\fBsetab\fR; the XPG4 draft says that "If the terminal
1630 supports ANSI escape sequences to set background and foreground, they should
1631 be coded as \fBsetaf\fR and \fBsetab\fR, respectively.
1634 supports other escape sequences to set background and foreground, they should
1635 be coded as \fBsetf\fR and \fBsetb\fR, respectively.
1636 The \fBvidputs\fR and the \fBrefresh\fP(3X) functions
1637 use the \fBsetaf\fR and \fBsetab\fR capabilities if they are defined.
1639 The \fBsetaf\fR/\fBsetab\fR and \fBsetf\fR/\fBsetb\fR capabilities take a
1640 single numeric argument each.
1641 Argument values 0-7 of \fBsetaf\fR/\fBsetab\fR are portably defined as
1642 follows (the middle column is the symbolic #define available in the header for
1643 the \fBcurses\fR or \fBncurses\fR libraries).
1644 The terminal hardware is free to
1645 map these as it likes, but the RGB values indicate normal locations in color
1652 \fBColor #define Value RGB\fR
1653 black \fBCOLOR_BLACK\fR 0 0, 0, 0
1654 red \fBCOLOR_RED\ \fR 1 max,0,0
1655 green \fBCOLOR_GREEN\fR 2 0,max,0
1656 yellow \fBCOLOR_YELLOW\fR 3 max,max,0
1657 blue \fBCOLOR_BLUE\fR 4 0,0,max
1658 magenta \fBCOLOR_MAGENTA\fR 5 max,0,max
1659 cyan \fBCOLOR_CYAN\fR 6 0,max,max
1660 white \fBCOLOR_WHITE\fR 7 max,max,max
1663 The argument values of \fBsetf\fR/\fBsetb\fR historically correspond to
1664 a different mapping, i.e.,
1669 \fBColor #define Value RGB\fR
1670 black \fBCOLOR_BLACK\fR 0 0, 0, 0
1671 blue \fBCOLOR_BLUE\fR 1 0,0,max
1672 green \fBCOLOR_GREEN\fR 2 0,max,0
1673 cyan \fBCOLOR_CYAN\fR 3 0,max,max
1674 red \fBCOLOR_RED\ \fR 4 max,0,0
1675 magenta \fBCOLOR_MAGENTA\fR 5 max,0,max
1676 yellow \fBCOLOR_YELLOW\fR 6 max,max,0
1677 white \fBCOLOR_WHITE\fR 7 max,max,max
1680 It is important to not confuse the two sets of color capabilities;
1681 otherwise red/blue will be interchanged on the display.
1683 On an HP-like terminal, use \fBscp\fR with a color-pair number parameter to set
1684 which color pair is current.
1686 Some terminals allow the \fIcolor values\fP to be modified:
1688 On a Tektronix-like terminal, the capability \fBccc\fR may be present to
1689 indicate that colors can be modified.
1690 If so, the \fBinitc\fR capability will
1691 take a color number (0 to \fBcolors\fR \- 1)and three more parameters which
1693 These three parameters default to being interpreted as RGB
1694 (Red, Green, Blue) values.
1695 If the boolean capability \fBhls\fR is present,
1696 they are instead as HLS (Hue, Lightness, Saturation) indices.
1700 On an HP-like terminal, \fBinitp\fR may give a capability for changing a
1702 It will take seven parameters; a color-pair number (0 to
1703 \fBmax_pairs\fR \- 1), and two triples describing first background and then
1705 These parameters must be (Red, Green, Blue) or
1706 (Hue, Lightness, Saturation) depending on \fBhls\fR.
1708 On some color terminals, colors collide with highlights.
1710 these collisions with the \fBncv\fR capability.
1711 This is a bit-mask of
1712 attributes not to be used when colors are enabled.
1713 The correspondence with the
1714 attributes understood by \fBcurses\fR is as follows:
1720 \fBAttribute Bit Decimal Set by\fR
1729 A_ALTCHARSET 8 256 sgr
1730 A_HORIZONTAL 9 512 sgr1
1733 A_RIGHT 12 4096 sgr1
1735 A_VERTICAL 14 16384 sgr1
1736 A_ITALIC 15 32768 sitm
1739 For example, on many IBM PC consoles, the underline attribute collides with the
1740 foreground color blue and is not available in color mode.
1742 an \fBncv\fR capability of 2.
1744 SVr4 curses does nothing with \fBncv\fR, ncurses recognizes it and optimizes
1745 the output in favor of colors.
1748 If the terminal requires other than a null (zero) character as a pad, then this
1749 can be given as pad.
1750 Only the first character of the pad string is used.
1751 If the terminal does not have a pad character, specify npc.
1752 Note that ncurses implements the termcap-compatible \fBPC\fR variable;
1753 though the application may set this value to something other than
1754 a null, ncurses will test \fBnpc\fR first and use napms if the terminal
1755 has no pad character.
1757 If the terminal can move up or down half a line,
1758 this can be indicated with
1764 This is primarily useful for superscripts and subscripts on hard-copy terminals.
1765 If a hard-copy terminal can eject to the next page (form feed), give this as
1767 (usually control/L).
1769 If there is a command to repeat a given character a given number of
1770 times (to save time transmitting a large number of identical characters)
1771 this can be indicated with the parameterized string
1773 The first parameter is the character to be repeated and the second
1774 is the number of times to repeat it.
1775 Thus, tparm(repeat_char, \(aqx\(aq, 10) is the same as \*(``xxxxxxxxxx\*(''.
1777 If the terminal has a settable command character, such as the \s-1TEKTRONIX\s+1 4025,
1778 this can be indicated with
1780 A prototype command character is chosen which is used in all capabilities.
1781 This character is given in the
1783 capability to identify it.
1784 The following convention is supported on some UNIX systems:
1785 The environment is to be searched for a
1787 variable, and if found, all
1788 occurrences of the prototype character are replaced with the character
1789 in the environment variable.
1791 Terminal descriptions that do not represent a specific kind of known
1800 (generic) capability so that programs can complain that they do not know
1801 how to talk to the terminal.
1802 (This capability does not apply to
1804 terminal descriptions for which the escape sequences are known.)
1806 If the terminal has a \*(``meta key\*('' which acts as a shift key,
1807 setting the 8th bit of any character transmitted, this fact can
1810 Otherwise, software will assume that the 8th bit is parity and it
1811 will usually be cleared.
1812 If strings exist to turn this \*(``meta mode\*('' on and off, they
1818 If the terminal has more lines of memory than will fit on the screen
1819 at once, the number of lines of memory can be indicated with
1823 indicates that the number of lines is not fixed,
1824 but that there is still more memory than fits on the screen.
1826 If the terminal is one of those supported by the \s-1UNIX\s+1 virtual
1827 terminal protocol, the terminal number can be given as
1831 strings which control an auxiliary printer connected to the terminal
1834 print the contents of the screen,
1836 turn off the printer, and
1838 turn on the printer.
1839 When the printer is on, all text sent to the terminal will be sent
1841 It is undefined whether the text is also displayed on the terminal screen
1842 when the printer is on.
1845 takes one parameter, and leaves the printer on for as many characters
1846 as the value of the parameter, then turns the printer off.
1847 The parameter should not exceed 255.
1850 is transparently passed to the printer while an
1854 .SS Glitches and Braindamage
1856 Hazeltine terminals, which do not allow \*(``~\*('' characters to be displayed should
1859 Terminals which ignore a line-feed immediately after an \fBam\fR wrap,
1860 such as the Concept and vt100,
1861 should indicate \fBxenl\fR.
1865 is required to get rid of standout
1866 (instead of merely writing normal text on top of it),
1867 \fBxhp\fP should be given.
1869 Teleray terminals, where tabs turn all characters moved over to blanks,
1870 should indicate \fBxt\fR (destructive tabs).
1871 Note: the variable indicating this is now \*(``dest_tabs_magic_smso\*(''; in
1872 older versions, it was teleray_glitch.
1873 This glitch is also taken to mean that it is not possible to position
1874 the cursor on top of a \*(``magic cookie\*('',
1875 that to erase standout mode it is instead necessary to use
1876 delete and insert line.
1877 The ncurses implementation ignores this glitch.
1879 The Beehive Superbee, which is unable to correctly transmit the escape
1880 or control/C characters, has
1882 indicating that the f1 key is used for escape and f2 for control/C.
1883 (Only certain Superbees have this problem, depending on the ROM.)
1884 Note that in older terminfo versions, this capability was called
1885 \*(``beehive_glitch\*(''; it is now \*(``no_esc_ctl_c\*(''.
1887 Other specific terminal problems may be corrected by adding more
1888 capabilities of the form \fBx\fR\fIx\fR.
1890 .SS Pitfalls of Long Entries
1892 Long terminfo entries are unlikely to be a problem; to date, no entry has even
1893 approached terminfo's 4096-byte string-table maximum.
1894 Unfortunately, the termcap
1895 translations are much more strictly limited (to 1023 bytes), thus termcap translations
1896 of long terminfo entries can cause problems.
1898 The man pages for 4.3BSD and older versions of \fBtgetent\fP instruct the user to
1899 allocate a 1024-byte buffer for the termcap entry.
1900 The entry gets null-terminated by
1901 the termcap library, so that makes the maximum safe length for a termcap entry
1903 Depending on what the application and the termcap library
1904 being used does, and where in the termcap file the terminal type that \fBtgetent\fP
1905 is searching for is, several bad things can happen.
1907 Some termcap libraries print a warning message or exit if they find an
1908 entry that's longer than 1023 bytes; others do not; others truncate the
1909 entries to 1023 bytes.
1910 Some application programs allocate more than
1911 the recommended 1K for the termcap entry; others do not.
1913 Each termcap entry has two important sizes associated with it: before
1914 \*(``tc\*('' expansion, and after \*(``tc\*('' expansion.
1915 \*(``tc\*('' is the capability that
1916 tacks on another termcap entry to the end of the current one, to add
1917 on its capabilities.
1918 If a termcap entry does not use the \*(``tc\*(''
1919 capability, then of course the two lengths are the same.
1921 The \*(``before tc expansion\*('' length is the most important one, because it
1922 affects more than just users of that particular terminal.
1924 length of the entry as it exists in /etc/termcap, minus the
1925 backslash-newline pairs, which \fBtgetent\fP strips out while reading it.
1926 Some termcap libraries strip off the final newline, too (GNU termcap does not).
1929 a termcap entry before expansion is more than 1023 bytes long,
1931 and the application has only allocated a 1k buffer,
1933 and the termcap library (like the one in BSD/OS 1.1 and GNU) reads
1934 the whole entry into the buffer, no matter what its length, to see
1935 if it is the entry it wants,
1937 and \fBtgetent\fP is searching for a terminal type that either is the
1938 long entry, appears in the termcap file after the long entry, or
1939 does not appear in the file at all (so that \fBtgetent\fP has to search
1940 the whole termcap file).
1942 Then \fBtgetent\fP will overwrite memory, perhaps its stack, and probably core dump
1944 Programs like telnet are particularly vulnerable; modern telnets
1945 pass along values like the terminal type automatically.
1946 The results are almost
1947 as undesirable with a termcap library, like SunOS 4.1.3 and Ultrix 4.4, that
1948 prints warning messages when it reads an overly long termcap entry.
1950 termcap library truncates long entries, like OSF/1 3.0, it is immune to dying
1951 here but will return incorrect data for the terminal.
1953 The \*(``after tc expansion\*('' length will have a similar effect to the
1954 above, but only for people who actually set TERM to that terminal
1955 type, since \fBtgetent\fP only does \*(``tc\*('' expansion once it is found the
1956 terminal type it was looking for, not while searching.
1958 In summary, a termcap entry that is longer than 1023 bytes can cause,
1959 on various combinations of termcap libraries and applications, a core
1960 dump, warnings, or incorrect operation.
1961 If it is too long even before
1962 \*(``tc\*('' expansion, it will have this effect even for users of some other
1963 terminal types and users whose TERM variable does not have a termcap
1966 When in \-C (translate to termcap) mode, the \fBncurses\fR implementation of
1967 \fB@TIC@\fR(1M) issues warning messages when the pre-tc length of a termcap
1968 translation is too long.
1969 The \-c (check) option also checks resolved (after tc
1971 .SS Binary Compatibility
1972 It is not wise to count on portability of binary terminfo entries between
1973 commercial UNIX versions.
1974 The problem is that there are at least two versions
1975 of terminfo (under HP\-UX and AIX) which diverged from System V terminfo after
1976 SVr1, and have added extension capabilities to the string table that (in the
1977 binary format) collide with System V and XSI Curses extensions.
1980 Searching for terminal descriptions in
1981 \fB$HOME/.terminfo\fR and TERMINFO_DIRS
1982 is not supported by older implementations.
1984 Some SVr4 \fBcurses\fR implementations, and all previous to SVr4, do not
1985 interpret the %A and %O operators in parameter strings.
1987 SVr4/XPG4 do not specify whether \fBmsgr\fR licenses movement while in
1988 an alternate-character-set mode (such modes may, among other things, map
1989 CR and NL to characters that do not trigger local motions).
1990 The \fBncurses\fR implementation ignores \fBmsgr\fR in \fBALTCHARSET\fR
1992 This raises the possibility that an XPG4
1993 implementation making the opposite interpretation may need terminfo
1994 entries made for \fBncurses\fR to have \fBmsgr\fR turned off.
1996 The \fBncurses\fR library handles insert-character and insert-character modes
1997 in a slightly non-standard way to get better update efficiency.
1999 the \fBInsert/Delete Character\fR subsection above.
2001 The parameter substitutions for \fBset_clock\fR and \fBdisplay_clock\fR are
2002 not documented in SVr4 or the XSI Curses standard.
2003 They are deduced from the
2004 documentation for the AT&T 505 terminal.
2006 Be careful assigning the \fBkmous\fR capability.
2007 The \fBncurses\fR library wants to interpret it as \fBKEY_MOUSE\fR,
2008 for use by terminals and emulators like xterm
2009 that can return mouse-tracking information in the keyboard-input stream.
2011 X/Open Curses does not mention italics.
2012 Portable applications must assume that numeric capabilities are
2013 signed 16-bit values.
2014 This includes the \fIno_color_video\fP (ncv) capability.
2015 The 32768 mask value used for italics with ncv can be confused with
2016 an absent or cancelled ncv.
2017 If italics should work with colors,
2018 then the ncv value must be specified, even if it is zero.
2020 Different commercial ports of terminfo and curses support different subsets of
2021 the XSI Curses standard and (in some cases) different extension sets.
2023 is a summary, accurate as of October 1995:
2025 \fBSVR4, Solaris, ncurses\fR \-\-
2026 These support all SVr4 capabilities.
2029 Supports the SVr4 set, adds one undocumented extended string
2030 capability (\fBset_pglen\fR).
2032 \fBSVr1, Ultrix\fR \-\-
2033 These support a restricted subset of terminfo capabilities.
2034 The booleans end with \fBxon_xoff\fR;
2035 the numerics with \fBwidth_status_line\fR;
2036 and the strings with \fBprtr_non\fR.
2039 Supports the SVr1 subset, plus the SVr[234] numerics \fBnum_labels\fR,
2040 \fBlabel_height\fR, \fBlabel_width\fR, plus function keys 11 through 63, plus
2041 \fBplab_norm\fR, \fBlabel_on\fR, and \fBlabel_off\fR, plus some incompatible
2042 extensions in the string table.
2045 Supports the SVr1 subset, plus function keys 11 through 63, plus a number
2046 of incompatible string table extensions.
2049 Supports both the SVr4 set and the AIX extensions.
2053 files containing terminal descriptions
2055 \fB@INFOCMP@\fR(1M),
2059 \fBcurs_color\fR(3X),
2060 \fBcurs_variables\fR(3X),
2062 \fBterm_variables\fR(3X).
2066 Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey.
2067 Based on pcurses by Pavel Curtis.