|
|
1.1 ! root 1: This is Info file ../info/termcap, produced by Makeinfo-1.49 from the ! 2: input file termcap.texi. ! 3: ! 4: This file documents the termcap library of the GNU system. ! 5: ! 6: Copyright (C) 1988 Free Software Foundation, Inc. ! 7: ! 8: Permission is granted to make and distribute verbatim copies of this ! 9: manual provided the copyright notice and this permission notice are ! 10: preserved on all copies. ! 11: ! 12: Permission is granted to copy and distribute modified versions of ! 13: this manual under the conditions for verbatim copying, provided that ! 14: the entire resulting derived work is distributed under the terms of a ! 15: permission notice identical to this one. ! 16: ! 17: Permission is granted to copy and distribute translations of this ! 18: manual into another language, under the above conditions for modified ! 19: versions, except that this permission notice may be stated in a ! 20: translation approved by the Foundation. ! 21: ! 22: ! 23: File: termcap, Node: Capabilities, Next: Summary, Prev: Data Base, Up: Top ! 24: ! 25: Definitions of the Terminal Capabilities ! 26: **************************************** ! 27: ! 28: This section is divided into many subsections, each for one aspect of ! 29: use of display terminals. For writing a display program, you usually ! 30: need only check the subsections for the operations you want to use. ! 31: For writing a terminal description, you must read each subsection and ! 32: fill in the capabilities described there. ! 33: ! 34: String capabilities that are display commands may require numeric ! 35: parameters (*note Parameters::.). Most such capabilities do not use ! 36: parameters. When a capability requires parameters, this is explicitly ! 37: stated at the beginning of its definition. In simple cases, the first ! 38: or second sentence of the definition mentions all the parameters, in ! 39: the order they should be given, using a name in upper case for each ! 40: one. For example, the `rp' capability is a command that requires two ! 41: parameters; its definition begins as follows: ! 42: ! 43: String of commands to output a graphic character C, repeated N ! 44: times. ! 45: ! 46: In complex cases or when there are many parameters, they are ! 47: described explicitly. ! 48: ! 49: When a capability is described as obsolete, this means that programs ! 50: should not be written to look for it, but terminal descriptions should ! 51: still be written to provide it. ! 52: ! 53: When a capability is described as very obsolete, this means that it ! 54: should be omitted from terminal descriptions as well. ! 55: ! 56: * Menu: ! 57: ! 58: * Basic:: Basic characteristics. ! 59: * Screen Size:: Screen size, and what happens when it changes. ! 60: * Cursor Motion:: Various ways to move the cursor. ! 61: * Scrolling:: Pushing text up and down on the screen. ! 62: * Wrapping:: What happens if you write a character in the last column. ! 63: * Windows:: Limiting the part of the window that output affects. ! 64: * Clearing:: Erasing one or many lines. ! 65: * Insdel Line:: Making new blank lines in mid-screen; deleting lines. ! 66: * Insdel Char:: Inserting and deleting characters within a line. ! 67: * Standout:: Highlighting some of the text. ! 68: * Underlining:: Underlining some of the text. ! 69: * Cursor Visibility:: Making the cursor more or less easy to spot. ! 70: * Bell:: Attracts user's attention; not localized on the screen. ! 71: * Keypad:: Recognizing when function keys or arrows are typed. ! 72: * Meta Key:: META acts like an extra shift key. ! 73: * Initialization:: Commands used to initialize or reset the terminal. ! 74: * Pad Specs:: Info for the kernel on how much padding is needed. ! 75: * Status Line:: A status line displays "background" information. ! 76: * Half-Line:: Moving by half-lines, for superscripts and subscripts. ! 77: * Printer:: Controlling auxiliary printers of display terminals. ! 78: ! 79: ! 80: File: termcap, Node: Basic, Next: Screen Size, Prev: Capabilities, Up: Capabilities ! 81: ! 82: Basic Characteristics ! 83: ===================== ! 84: ! 85: This section documents the capabilities that describe the basic and ! 86: nature of the terminal, and also those that are relevant to the output ! 87: of graphic characters. ! 88: ! 89: `os' ! 90: Flag whose presence means that the terminal can overstrike. This ! 91: means that outputting a graphic character does not erase whatever ! 92: was present in the same character position before. The terminals ! 93: that can overstrike include printing terminals, storage tubes (all ! 94: obsolete nowadays), and many bit-map displays. ! 95: ! 96: `eo' ! 97: Flag whose presence means that outputting a space erases a ! 98: character position even if the terminal supports overstriking. If ! 99: this flag is not present and overstriking is supported, output of ! 100: a space has no effect except to move the cursor. ! 101: ! 102: (On terminals that do not support overstriking, you can always ! 103: assume that outputting a space at a position erases whatever ! 104: character was previously displayed there.) ! 105: ! 106: `gn' ! 107: Flag whose presence means that this terminal type is a generic type ! 108: which does not really describe any particular terminal. Generic ! 109: types are intended for use as the default type assigned when the ! 110: user connects to the system, with the intention that the user ! 111: should specify what type he really has. One example of a generic ! 112: type is the type `network'. ! 113: ! 114: Since the generic type cannot say how to do anything interesting ! 115: with the terminal, termcap-using programs will always find that the ! 116: terminal is too weak to be supported if the user has failed to ! 117: specify a real terminal type in place of the generic one. The ! 118: `gn' flag directs these programs to use a different error message: ! 119: "You have not specified your real terminal type", rather than ! 120: "Your terminal is not powerful enough to be used". ! 121: ! 122: `hc' ! 123: Flag whose presence means this is a hardcopy terminal. ! 124: ! 125: `rp' ! 126: String of commands to output a graphic character C, repeated N ! 127: times. The first parameter value is the ASCII code for the desired ! 128: character, and the second parameter is the number of times to ! 129: repeat the character. Often this command requires padding ! 130: proportional to the number of times the character is repeated. ! 131: This effect can be had by using parameter arithmetic with ! 132: `%'-sequences to compute the amount of padding, then generating ! 133: the result as a number at the front of the string so that `tputs' ! 134: will treat it as padding. ! 135: ! 136: `hz' ! 137: Flag whose presence means that the ASCII character `~' cannot be ! 138: output on this terminal because it is used for display commands. ! 139: ! 140: Programs handle this flag by checking all text to be output and ! 141: replacing each `~' with some other character(s). If this is not ! 142: done, the screen will be thoroughly garbled. ! 143: ! 144: The old Hazeltine terminals that required such treatment are ! 145: probably very rare today, so you might as well not bother to ! 146: support this flag. ! 147: ! 148: `CC' ! 149: String whose presence means the terminal has a settable command ! 150: character. The value of the string is the default command ! 151: character (which is usually ESC). ! 152: ! 153: All the strings of commands in the terminal description should be ! 154: written to use the default command character. If you are writing ! 155: an application program that changes the command character, use the ! 156: `CC' capability to figure out how to translate all the display ! 157: commands to work with the new command character. ! 158: ! 159: Most programs have no reason to look at the `CC' capability. ! 160: ! 161: `xb' ! 162: Flag whose presence identifies Superbee terminals which are unable ! 163: to transmit the characters ESC and `Control-C'. Programs which ! 164: support this flag are supposed to check the input for the code ! 165: sequences sent by the F1 and F2 keys, and pretend that ESC or ! 166: `Control-C' (respectively) had been read. But this flag is ! 167: obsolete, and not worth supporting. ! 168: ! 169: ! 170: File: termcap, Node: Screen Size, Next: Cursor Motion, Prev: Basic, Up: Capabilities ! 171: ! 172: Screen Size ! 173: =========== ! 174: ! 175: A terminal description has two capabilities, `co' and `li', that ! 176: describe the screen size in columns and lines. But there is more to ! 177: the question of screen size than this. ! 178: ! 179: On some operating systems the "screen" is really a window and the ! 180: effective width can vary. On some of these systems, `tgetnum' uses the ! 181: actual width of the window to decide what value to return for the `co' ! 182: capability, overriding what is actually written in the terminal ! 183: description. On other systems, it is up to the application program to ! 184: check the actual window width using a system call. For example, on BSD ! 185: 4.3 systems, the system call `ioctl' with code `TIOCGWINSZ' will tell ! 186: you the current screen size. ! 187: ! 188: On all window systems, termcap is powerless to advise the application ! 189: program if the user resizes the window. Application programs must deal ! 190: with this possibility in a system-dependent fashion. On some systems ! 191: the C shell handles part of the problem by detecting changes in window ! 192: size and setting the `TERMCAP' environment variable appropriately. ! 193: This takes care of application programs that are started subsequently. ! 194: It does not help application programs already running. ! 195: ! 196: On some systems, including BSD 4.3, all programs using a terminal get ! 197: a signal named `SIGWINCH' whenever the screen size changes. Programs ! 198: that use termcap should handle this signal by using `ioctl TIOCGWINSZ' ! 199: to learn the new screen size. ! 200: ! 201: `co' ! 202: Numeric value, the width of the screen in character positions. ! 203: Even hardcopy terminals normally have a `co' capability. ! 204: ! 205: `li' ! 206: Numeric value, the height of the screen in lines. ! 207: ! 208: ! 209: File: termcap, Node: Cursor Motion, Next: Wrapping, Prev: Screen Size, Up: Capabilities ! 210: ! 211: Cursor Motion ! 212: ============= ! 213: ! 214: Termcap assumes that the terminal has a "cursor", a spot on the ! 215: screen where a visible mark is displayed, and that most display ! 216: commands take effect at the position of the cursor. It follows that ! 217: moving the cursor to a specified location is very important. ! 218: ! 219: There are many terminal capabilities for different cursor motion ! 220: operations. A terminal description should define as many as possible, ! 221: but most programs do not need to use most of them. One capability, ! 222: `cm', moves the cursor to an arbitrary place on the screen; this by ! 223: itself is sufficient for any application as long as there is no need to ! 224: support hardcopy terminals or certain old, weak displays that have only ! 225: relative motion commands. Use of other cursor motion capabilities is an ! 226: optimization, enabling the program to output fewer characters in some ! 227: common cases. ! 228: ! 229: If you plan to use the relative cursor motion commands in an ! 230: application program, you must know what the starting cursor position ! 231: is. To do this, you must keep track of the cursor position and update ! 232: the records each time anything is output to the terminal, including ! 233: graphic characters. In addition, it is necessary to know whether the ! 234: terminal wraps after writing in the rightmost column. *Note Wrapping::. ! 235: ! 236: One other motion capability needs special mention: `nw' moves the ! 237: cursor to the beginning of the following line, perhaps clearing all the ! 238: starting line after the cursor, or perhaps not clearing at all. This ! 239: capability is a least common denominator that is probably supported ! 240: even by terminals that cannot do most other things such as `cm' or `do'. ! 241: Even hardcopy terminals can support `nw'. ! 242: ! 243: `cm' ! 244: String of commands to position the cursor at line L, column C. ! 245: Both parameters are origin-zero, and are defined relative to the ! 246: screen, not relative to display memory. ! 247: ! 248: All display terminals except a few very obsolete ones support `cm', ! 249: so it is acceptable for an application program to refuse to ! 250: operate on terminals lacking `cm'. ! 251: ! 252: `ho' ! 253: String of commands to move the cursor to the upper left corner of ! 254: the screen (this position is called the "home position"). In ! 255: terminals where the upper left corner of the screen is not the ! 256: same as the beginning of display memory, this command must go to ! 257: the upper left corner of the screen, not the beginning of display ! 258: memory. ! 259: ! 260: Every display terminal supports this capability, and many ! 261: application programs refuse to operate if the `ho' capability is ! 262: missing. ! 263: ! 264: `ll' ! 265: String of commands to move the cursor to the lower left corner of ! 266: the screen. On some terminals, moving up from home position does ! 267: this, but programs should never assume that will work. Just ! 268: output the `ll' string (if it is provided); if moving to home ! 269: position and then moving up is the best way to get there, the `ll' ! 270: command will do that. ! 271: ! 272: `cr' ! 273: String of commands to move the cursor to the beginning of the line ! 274: it is on. If this capability is not specified, many programs ! 275: assume they can use the ASCII carriage return character for this. ! 276: ! 277: `le' ! 278: String of commands to move the cursor left one column. Unless the ! 279: `bw' flag capability is specified, the effect is undefined if the ! 280: cursor is at the left margin; do not use this command there. If ! 281: `bw' is present, this command may be used at the left margin, and ! 282: it wraps the cursor to the last column of the preceding line. ! 283: ! 284: `nd' ! 285: String of commands to move the cursor right one column. The ! 286: effect is undefined if the cursor is at the right margin; do not ! 287: use this command there, not even if `am' is present. ! 288: ! 289: `up' ! 290: String of commands to move the cursor vertically up one line. The ! 291: effect of sending this string when on the top line is undefined; ! 292: programs should never use it that way. ! 293: ! 294: `do' ! 295: String of commands to move the cursor vertically down one line. ! 296: The effect of sending this string when on the bottom line is ! 297: undefined; programs should never use it that way. ! 298: ! 299: The original idea was that this string would not contain a newline ! 300: character and therefore could be used without disabling the ! 301: kernel's usual habit of converting of newline into a ! 302: carriage-return newline sequence. But many terminal descriptions ! 303: do use newline in the `do' string, so this is not possible; a ! 304: program which sends the `do' string must disable output conversion ! 305: in the kernel (*note Initialize::.). ! 306: ! 307: `bw' ! 308: Flag whose presence says that `le' may be used in column zero to ! 309: move to the last column of the preceding line. If this flag is ! 310: not present, `le' should not be used in column zero. ! 311: ! 312: `nw' ! 313: String of commands to move the cursor to start of next line, ! 314: possibly clearing rest of line (following the cursor) before ! 315: moving. ! 316: ! 317: `DO', `UP', `LE', `RI' ! 318: Strings of commands to move the cursor N lines down vertically, up ! 319: vertically, or N columns left or right. Do not attempt to move ! 320: past any edge of the screen with these commands; the effect of ! 321: trying that is undefined. Only a few terminal descriptions provide ! 322: these commands, and most programs do not use them. ! 323: ! 324: `CM' ! 325: String of commands to position the cursor at line L, column C, ! 326: relative to display memory. Both parameters are origin-zero. This ! 327: capability is present only in terminals where there is a ! 328: difference between screen-relative and memory-relative addressing, ! 329: and not even in all such terminals. ! 330: ! 331: `ch' ! 332: String of commands to position the cursor at column C in the same ! 333: line it is on. This is a special case of `cm' in which the ! 334: vertical position is not changed. The `ch' capability is provided ! 335: only when it is faster to output than `cm' would be in this ! 336: special case. Programs should not assume most display terminals ! 337: have `ch'. ! 338: ! 339: `cv' ! 340: String of commands to position the cursor at line L in the same ! 341: column. This is a special case of `cm' in which the horizontal ! 342: position is not changed. The `cv' capability is provided only ! 343: when it is faster to output than `cm' would be in this special ! 344: case. Programs should not assume most display terminals have `cv'. ! 345: ! 346: `sc' ! 347: String of commands to make the terminal save the current cursor ! 348: position. Only the last saved position can be used. If this ! 349: capability is present, `rc' should be provided also. Most ! 350: terminals have neither. ! 351: ! 352: `rc' ! 353: String of commands to make the terminal restore the last saved ! 354: cursor position. If this capability is present, `sc' should be ! 355: provided also. Most terminals have neither. ! 356: ! 357: `ff' ! 358: String of commands to advance to the next page, for a hardcopy ! 359: terminal. ! 360: ! 361: `ta' ! 362: String of commands to move the cursor right to the next hardware ! 363: tab stop column. Missing if the terminal does not have any kind of ! 364: hardware tabs. Do not send this command if the kernel's terminal ! 365: modes say that the kernel is expanding tabs into spaces. ! 366: ! 367: `bt' ! 368: String of commands to move the cursor left to the previous hardware ! 369: tab stop column. Missing if the terminal has no such ability; many ! 370: terminals do not. Do not send this command if the kernel's ! 371: terminal modes say that the kernel is expanding tabs into spaces. ! 372: ! 373: The following obsolete capabilities should be included in terminal ! 374: descriptions when appropriate, but should not be looked at by new ! 375: programs. ! 376: ! 377: `nc' ! 378: Flag whose presence means the terminal does not support the ASCII ! 379: carriage return character as `cr'. This flag is needed because ! 380: old programs assume, when the `cr' capability is missing, that ! 381: ASCII carriage return can be used for the purpose. We use `nc' to ! 382: tell the old programs that carriage return may not be used. ! 383: ! 384: New programs should not assume any default for `cr', so they need ! 385: not look at `nc'. However, descriptions should contain `nc' ! 386: whenever they do not contain `cr'. ! 387: ! 388: `xt' ! 389: Flag whose presence means that the ASCII tab character may not be ! 390: used for cursor motion. This flag exists because old programs ! 391: assume, when the `ta' capability is missing, that ASCII tab can be ! 392: used for the purpose. We use `xt' to tell the old programs not to ! 393: use tab. ! 394: ! 395: New programs should not assume any default for `ta', so they need ! 396: not look at `xt' in connection with cursor motion. Note that `xt' ! 397: also has implications for standout mode (*note Standout::.). It is ! 398: obsolete in regard to cursor motion but not in regard to standout. ! 399: ! 400: In fact, `xt' means that the terminal is a Teleray 1061. ! 401: ! 402: `bc' ! 403: Very obsolete alternative name for the `le' capability. ! 404: ! 405: `bs' ! 406: Flag whose presence means that the ASCII character backspace may be ! 407: used to move the cursor left. Obsolete; look at `le' instead. ! 408: ! 409: `nl' ! 410: Obsolete capability which is a string that can either be used to ! 411: move the cursor down or to scroll. The same string must scroll ! 412: when used on the bottom line and move the cursor when used on any ! 413: other line. New programs should use `do' or `sf', and ignore `nl'. ! 414: ! 415: If there is no `nl' capability, some old programs assume they can ! 416: use the newline character for this purpose. These programs follow ! 417: a bad practice, but because they exist, it is still desirable to ! 418: define the `nl' capability in a terminal description if the best ! 419: way to move down is *not* a newline. ! 420: ! 421: ! 422: File: termcap, Node: Wrapping, Next: Scrolling, Prev: Cursor Motion, Up: Capabilities ! 423: ! 424: Wrapping ! 425: ======== ! 426: ! 427: "Wrapping" means moving the cursor from the right margin to the left ! 428: margin of the following line. Some terminals wrap automatically when a ! 429: graphic character is output in the last column, while others do not. ! 430: Most application programs that use termcap need to know whether the ! 431: terminal wraps. There are two special flag capabilities to describe ! 432: what the terminal does when a graphic character is output in the last ! 433: column. ! 434: ! 435: `am' ! 436: Flag whose presence means that writing a character in the last ! 437: column causes the cursor to wrap to the beginning of the next line. ! 438: ! 439: If `am' is not present, writing in the last column leaves the ! 440: cursor at the place where the character was written. ! 441: ! 442: Writing in the last column of the last line should be avoided on ! 443: terminals with `am', as it may or may not cause scrolling to occur ! 444: (*note Scrolling::.). Scrolling is surely not what you would ! 445: intend. ! 446: ! 447: If your program needs to check the `am' flag, then it also needs ! 448: to check the `xn' flag which indicates that wrapping happens in a ! 449: strange way. Many common terminals have the `xn' flag. ! 450: ! 451: `xn' ! 452: Flag whose presence means that the cursor wraps in a strange way. ! 453: At least two distinct kinds of strange behavior are known; the ! 454: termcap data base does not contain anything to distinguish the two. ! 455: ! 456: On Concept-100 terminals, output in the last column wraps the ! 457: cursor almost like an ordinary `am' terminal. But if the next ! 458: thing output is a newline, it is ignored. ! 459: ! 460: DEC VT-100 terminals (when the wrap switch is on) do a different ! 461: strange thing: the cursor wraps only if the next thing output is ! 462: another graphic character. In fact, the wrap occurs when the ! 463: following graphic character is received by the terminal, before the ! 464: character is placed on the screen. ! 465: ! 466: On both of these terminals, after writing in the last column a ! 467: following graphic character will be displayed in the first column ! 468: of the following line. But the effect of relative cursor motion ! 469: characters such as newline or backspace at such a time depends on ! 470: the terminal. The effect of erase or scrolling commands also ! 471: depends on the terminal. You can't assume anything about what ! 472: they will do on a terminal that has `xn'. So, to be safe, you ! 473: should never do these things at such a time on such a terminal. ! 474: ! 475: To be sure of reliable results on a terminal which has the `xn' ! 476: flag, output a `cm' absolute positioning command after writing in ! 477: the last column. Another safe thing to do is to output ! 478: carriage-return newline, which will leave the cursor at the ! 479: beginning of the following line. ! 480: ! 481: ! 482: File: termcap, Node: Scrolling, Next: Windows, Prev: Wrapping, Up: Capabilities ! 483: ! 484: Scrolling ! 485: ========= ! 486: ! 487: "Scrolling" means moving the contents of the screen up or down one or ! 488: more lines. Moving the contents up is "forward scrolling"; moving them ! 489: down is "reverse scrolling". ! 490: ! 491: Scrolling happens after each line of output during ordinary output ! 492: on most display terminals. But in an application program that uses ! 493: termcap for random-access output, scrolling happens only when ! 494: explicitly requested with the commands in this section. ! 495: ! 496: Some terminals have a "scroll region" feature. This lets you limit ! 497: the effect of scrolling to a specified range of lines. Lines outside ! 498: the range are unaffected when scrolling happens. The scroll region ! 499: feature is available if either `cs' or `cS' is present. ! 500: ! 501: `sf' ! 502: String of commands to scroll the screen one line up, assuming it is ! 503: output with the cursor at the beginning of the bottom line. ! 504: ! 505: `sr' ! 506: String of commands to scroll the screen one line down, assuming it ! 507: is output with the cursor at the beginning of the top line. ! 508: ! 509: `SF' ! 510: String of commands to scroll the screen N lines up, assuming it is ! 511: output with the cursor at the beginning of the bottom line. ! 512: ! 513: `SR' ! 514: String of commands to scroll the screen N line down, assuming it ! 515: is output with the cursor at the beginning of the top line. ! 516: ! 517: `cs' ! 518: String of commands to set the scroll region. This command takes ! 519: two parameters, START and END, which are the line numbers ! 520: (origin-zero) of the first line to include in the scroll region ! 521: and of the last line to include in it. When a scroll region is ! 522: set, scrolling is limited to the specified range of lines; lines ! 523: outside the range are not affected by scroll commands. ! 524: ! 525: Do not try to move the cursor outside the scroll region. The ! 526: region remains set until explicitly removed. To remove the scroll ! 527: region, use another `cs' command specifying the full height of the ! 528: screen. ! 529: ! 530: The cursor position is undefined after the `cs' command is set, so ! 531: position the cursor with `cm' immediately afterward. ! 532: ! 533: `cS' ! 534: String of commands to set the scroll region using parameters in ! 535: different form. The effect is the same as if `cs' were used. Four ! 536: parameters are required: ! 537: ! 538: 1. Total number of lines on the screen. ! 539: ! 540: 2. Number of lines above desired scroll region. ! 541: ! 542: 3. Number of lines below (outside of) desired scroll region. ! 543: ! 544: 4. Total number of lines on the screen, the same as the first ! 545: parameter. ! 546: ! 547: This capability is a GNU extension that was invented to allow the ! 548: Ann Arbor Ambassador's scroll-region command to be described; it ! 549: could also be done by putting non-Unix `%'-sequences into a `cs' ! 550: string, but that would have confused Unix programs that used the ! 551: `cs' capability with the Unix termcap. Currently only GNU Emacs ! 552: uses the `cS' capability. ! 553: ! 554: `ns' ! 555: Flag which means that the terminal does not normally scroll for ! 556: ordinary sequential output. For modern terminals, this means that ! 557: outputting a newline in ordinary sequential output with the cursor ! 558: on the bottom line wraps to the top line. For some obsolete ! 559: terminals, other things may happen. ! 560: ! 561: The terminal may be able to scroll even if it does not normally do ! 562: so. If the `sf' capability is provided, it can be used for ! 563: scrolling regardless of `ns'. ! 564: ! 565: `da' ! 566: Flag whose presence means that lines scrolled up off the top of the ! 567: screen may come back if scrolling down is done subsequently. ! 568: ! 569: The `da' and `db' flags do not, strictly speaking, affect how to ! 570: scroll. But programs that scroll usually need to clear the lines ! 571: scrolled onto the screen, if these flags are present. ! 572: ! 573: `db' ! 574: Flag whose presence means that lines scrolled down off the bottom ! 575: of the screen may come back if scrolling up is done subsequently. ! 576: ! 577: `lm' ! 578: Numeric value, the number of lines of display memory that the ! 579: terminal has. A value of zero means that the terminal has more ! 580: display memory than can fit on the screen, but no fixed number of ! 581: lines. (The number of lines may depend on the amount of text in ! 582: each line.) ! 583: ! 584: Any terminal description that defines `SF' should also define `sf'; ! 585: likewise for `SR' and `sr'. However, many terminals can only scroll by ! 586: one line at a time, so it is common to find `sf' and not `SF', or `sr' ! 587: without `SR'. ! 588: ! 589: Therefore, all programs that use the scrolling facilities should be ! 590: prepared to work with `sf' in the case that `SF' is absent, and ! 591: likewise with `sr'. On the other hand, an application program that ! 592: uses only `sf' and not `SF' is acceptable, though slow on some ! 593: terminals. ! 594: ! 595: When outputting a scroll command with `tputs', the NLINES argument ! 596: should be the total number of lines in the portion of the screen being ! 597: scrolled. Very often these commands require padding proportional to ! 598: this number of lines. *Note Padding::. ! 599: ! 600: ! 601: File: termcap, Node: Windows, Next: Clearing, Prev: Scrolling, Up: Capabilities ! 602: ! 603: Windows ! 604: ======= ! 605: ! 606: A "window", in termcap, is a rectangular portion of the screen to ! 607: which all display operations are restricted. Wrapping, clearing, ! 608: scrolling, insertion and deletion all operate as if the specified ! 609: window were all the screen there was. ! 610: ! 611: `wi' ! 612: String of commands to set the terminal output screen window. This ! 613: string requires four parameters, all origin-zero: ! 614: 1. The first line to include in the window. ! 615: ! 616: 2. The last line to include in the window. ! 617: ! 618: 3. The first column to include in the window. ! 619: ! 620: 4. The last column to include in the window. ! 621: ! 622: Most terminals do not support windows. ! 623: ! 624: ! 625: File: termcap, Node: Clearing, Next: Insdel Line, Prev: Windows, Up: Capabilities ! 626: ! 627: Clearing Parts of the Screen ! 628: ============================ ! 629: ! 630: There are several terminal capabilities for clearing parts of the ! 631: screen to blank. All display terminals support the `cl' string, and ! 632: most display terminals support all of these capabilities. ! 633: ! 634: `cl' ! 635: String of commands to clear the entire screen and position the ! 636: cursor at the upper left corner. ! 637: ! 638: `cd' ! 639: String of commands to clear the line the cursor is on, and all the ! 640: lines below it, down to the bottom of the screen. This command ! 641: string should be used only with the cursor in column zero; their ! 642: effect is undefined if the cursor is elsewhere. ! 643: ! 644: `ce' ! 645: String of commands to clear from the cursor to the end of the ! 646: current line. ! 647: ! 648: `ec' ! 649: String of commands to clear N characters, starting with the ! 650: character that the cursor is on. This command string is expected ! 651: to leave the cursor position unchanged. The parameter N should ! 652: never be large enough to reach past the right margin; the effect ! 653: of such a large parameter would be undefined. ! 654: ! 655: Clear to end of line (`ce') is extremely important in programs that ! 656: maintain an updating display. Nearly all display terminals support this ! 657: operation, so it is acceptable for a an application program to refuse to ! 658: work if `ce' is not present. However, if you do not want this ! 659: limitation, you can accomplish clearing to end of line by outputting ! 660: spaces until you reach the right margin. In order to do this, you must ! 661: know the current horizontal position. Also, this technique assumes ! 662: that writing a space will erase. But this happens to be true on all ! 663: the display terminals that fail to support `ce'. ! 664: ! 665: ! 666: File: termcap, Node: Insdel Line, Next: Insdel Char, Prev: Clearing, Up: Capabilities ! 667: ! 668: Insert/Delete Line ! 669: ================== ! 670: ! 671: "Inserting a line" means creating a blank line in the middle of the ! 672: screen, and pushing the existing lines of text apart. In fact, the ! 673: lines above the insertion point do not change, while the lines below ! 674: move down, and one is normally lost at the bottom of the screen. ! 675: ! 676: "Deleting a line" means causing the line to disappear from the ! 677: screen, closing up the gap by moving the lines below it upward. A new ! 678: line appears at the bottom of the screen. Usually this line is blank, ! 679: but on terminals with the `db' flag it may be a line previously moved ! 680: off the screen bottom by scrolling or line insertion. ! 681: ! 682: Insertion and deletion of lines is useful in programs that maintain ! 683: an updating display some parts of which may get longer or shorter. ! 684: They are also useful in editors for scrolling parts of the screen, and ! 685: for redisplaying after lines of text are killed or inserted. ! 686: ! 687: Many terminals provide commands to insert or delete a single line at ! 688: the cursor position. Some provide the ability to insert or delete ! 689: several lines with one command, using the number of lines to insert or ! 690: delete as a parameter. Always move the cursor to column zero before ! 691: using any of these commands. ! 692: ! 693: `al' ! 694: String of commands to insert a blank line before the line the ! 695: cursor is on. The existing line, and all lines below it, are ! 696: moved down. The last line in the screen (or in the scroll region, ! 697: if one is set) disappears and in most circumstances is discarded. ! 698: It may not be discarded if the `db' is present (*note ! 699: Scrolling::.). ! 700: ! 701: The cursor must be at the left margin before this command is used. ! 702: This command does not move the cursor. ! 703: ! 704: `dl' ! 705: String of commands to delete the line the cursor is on. The ! 706: following lines move up, and a blank line appears at the bottom of ! 707: the screen (or bottom of the scroll region). If the terminal has ! 708: the `db' flag, a nonblank line previously pushed off the screen ! 709: bottom may reappear at the bottom. ! 710: ! 711: The cursor must be at the left margin before this command is used. ! 712: This command does not move the cursor. ! 713: ! 714: `AL' ! 715: String of commands to insert N blank lines before the line that ! 716: the cursor is on. It is like `al' repeated N times, except that ! 717: it is as fast as one `al'. ! 718: ! 719: `DL' ! 720: String of commands to delete N lines starting with the line that ! 721: the cursor is on. It is like `dl' repeated N times, except that ! 722: it is as fast as one `dl'. ! 723: ! 724: Any terminal description that defines `AL' should also define `al'; ! 725: likewise for `DL' and `dl'. However, many terminals can only insert or ! 726: delete one line at a time, so it is common to find `al' and not `AL', ! 727: or `dl' without `DL'. ! 728: ! 729: Therefore, all programs that use the insert and delete facilities ! 730: should be prepared to work with `al' in the case that `AL' is absent, ! 731: and likewise with `dl'. On the other hand, it is acceptable to write ! 732: an application that uses only `al' and `dl' and does not look for `AL' ! 733: or `DL' at all. ! 734: ! 735: If a terminal does not support line insertion and deletion directly, ! 736: but does support a scroll region, the effect of insertion and deletion ! 737: can be obtained with scrolling. However, it is up to the individual ! 738: user program to check for this possibility and use the scrolling ! 739: commands to get the desired result. It is fairly important to implement ! 740: this alternate strategy, since it is the only way to get the effect of ! 741: line insertion and deletion on the popular VT100 terminal. ! 742: ! 743: Insertion and deletion of lines is affected by the scroll region on ! 744: terminals that have a settable scroll region. This is useful when it is ! 745: desirable to move any few consecutive lines up or down by a few lines. ! 746: *Note Scrolling::. ! 747: ! 748: The line pushed off the bottom of the screen is not lost if the ! 749: terminal has the `db' flag capability; instead, it is pushed into ! 750: display memory that does not appear on the screen. This is the same ! 751: thing that happens when scrolling pushes a line off the bottom of the ! 752: screen. Either reverse scrolling or deletion of a line can bring the ! 753: apparently lost line back onto the bottom of the screen. If the ! 754: terminal has the scroll region feature as well as `db', the pushed-out ! 755: line really is lost if a scroll region is in effect. ! 756: ! 757: When outputting an insert or delete command with `tputs', the NLINES ! 758: argument should be the total number of lines from the cursor to the ! 759: bottom of the screen (or scroll region). Very often these commands ! 760: require padding proportional to this number of lines. *Note Padding::. ! 761: ! 762: For `AL' and `DL' the NLINES argument should *not* depend on the ! 763: number of lines inserted or deleted; only the total number of lines ! 764: affected. This is because it is just as fast to insert two or N lines ! 765: with `AL' as to insert one line with `al'. ! 766: ! 767: ! 768: File: termcap, Node: Insdel Char, Next: Standout, Prev: Insdel Line, Up: Capabilities ! 769: ! 770: Insert/Delete Character ! 771: ======================= ! 772: ! 773: "Inserting a character" means creating a blank space in the middle ! 774: of a line, and pushing the rest of the line rightward. The character ! 775: in the rightmost column is lost. ! 776: ! 777: "Deleting a character" means causing the character to disappear from ! 778: the screen, closing up the gap by moving the rest of the line leftward. ! 779: A blank space appears in the rightmost column. ! 780: ! 781: Insertion and deletion of characters is useful in programs that ! 782: maintain an updating display some parts of which may get longer or ! 783: shorter. It is also useful in editors for redisplaying the results of ! 784: editing within a line. ! 785: ! 786: Many terminals provide commands to insert or delete a single ! 787: character at the cursor position. Some provide the ability to insert ! 788: or delete several characters with one command, using the number of ! 789: characters to insert or delete as a parameter. ! 790: ! 791: Many terminals provide an insert mode in which outputting a graphic ! 792: character has the added effect of inserting a position for that ! 793: character. A special command string is used to enter insert mode and ! 794: another is used to exit it. The reason for designing a terminal with ! 795: an insert mode rather than an insert command is that inserting ! 796: character positions is usually followed by writing characters into ! 797: them. With insert mode, this is as fast as simply writing the ! 798: characters, except for the fixed overhead of entering and leaving ! 799: insert mode. However, when the line speed is great enough, padding may ! 800: be required for the graphic characters output in insert mode. ! 801: ! 802: Some terminals require you to enter insert mode and then output a ! 803: special command for each position to be inserted. Or they may require ! 804: special commands to be output before or after each graphic character to ! 805: be inserted. ! 806: ! 807: Deletion of characters is usually accomplished by a straightforward ! 808: command to delete one or several positions; but on some terminals, it ! 809: is necessary to enter a special delete mode before using the delete ! 810: command, and leave delete mode afterward. Sometimes delete mode and ! 811: insert mode are the same mode. ! 812: ! 813: Some terminals make a distinction between character positions in ! 814: which a space character has been output and positions which have been ! 815: cleared. On these terminals, the effect of insert or delete character ! 816: runs to the first cleared position rather than to the end of the line. ! 817: In fact, the effect may run to more than one line if there is no ! 818: cleared position to stop the shift on the first line. These terminals ! 819: are identified by the `in' flag capability. ! 820: ! 821: On terminals with the `in' flag, the technique of skipping over ! 822: characters that you know were cleared, and then outputting text later ! 823: on in the same line, causes later insert and delete character ! 824: operations on that line to do nonstandard things. A program that has ! 825: any chance of doing this must check for the `in' flag and must be ! 826: careful to write explicit space characters into the intermediate ! 827: columns when `in' is present. ! 828: ! 829: A plethora of terminal capabilities are needed to describe all of ! 830: this complexity. Here is a list of them all. Following the list, we ! 831: present an algorithm for programs to use to take proper account of all ! 832: of these capabilities. ! 833: ! 834: `im' ! 835: String of commands to enter insert mode. ! 836: ! 837: If the terminal has no special insert mode, but it can insert ! 838: characters with a special command, `im' should be defined with a ! 839: null value, because the `vi' editor assumes that insertion of a ! 840: character is impossible if `im' is not provided. ! 841: ! 842: New programs should not act like `vi'. They should pay attention ! 843: to `im' only if it is defined. ! 844: ! 845: `ei' ! 846: String of commands to leave insert mode. This capability must be ! 847: present if `im' is. ! 848: ! 849: On a few old terminals the same string is used to enter and exit ! 850: insert mode. This string turns insert mode on if it was off, and ! 851: off it it was on. You can tell these terminals because the `ei' ! 852: string equals the `im' string. If you want to support these ! 853: terminals, you must always remember accurately whether insert mode ! 854: is in effect. However, these terminals are obsolete, and it is ! 855: reasonable to refuse to support them. On all modern terminals, you ! 856: can safely output `ei' at any time to ensure that insert mode is ! 857: turned off. ! 858: ! 859: `ic' ! 860: String of commands to insert one character position at the cursor. ! 861: The cursor does not move. ! 862: ! 863: If outputting a graphic character while in insert mode is ! 864: sufficient to insert the character, then the `ic' capability ! 865: should be defined with a null value. ! 866: ! 867: If your terminal offers a choice of ways to insert--either use ! 868: insert mode or use a special command--then define `im' and do not ! 869: define `ic', since this gives the most efficient operation when ! 870: several characters are to be inserted. *Do not* define both ! 871: strings, for that means that *both* must be used each time ! 872: insertion is done. ! 873: ! 874: `ip' ! 875: String of commands to output following an inserted graphic ! 876: character in insert mode. Often it is used just for a padding ! 877: spec, when padding is needed after an inserted character (*note ! 878: Padding::.). ! 879: ! 880: `IC' ! 881: String of commands to insert N character positions at and after ! 882: the cursor. It has the same effect as repeating the `ic' string ! 883: and a space, N times. ! 884: ! 885: If `IC' is provided, application programs may use it without first ! 886: entering insert mode. ! 887: ! 888: `mi' ! 889: Flag whose presence means it is safe to move the cursor while in ! 890: insert mode and assume the terminal remains in insert mode. ! 891: ! 892: `in' ! 893: Flag whose presence means that the terminal distinguishes between ! 894: character positions in which space characters have been output and ! 895: positions which have been cleared. ! 896: ! 897: An application program can assume that the terminal can do character ! 898: insertion if *any one of* the capabilities `IC', `im', `ic' or `ip' is ! 899: provided. ! 900: ! 901: To insert N blank character positions, move the cursor to the place ! 902: to insert them and follow this algorithm: ! 903: ! 904: 1. If an `IC' string is provided, output it with parameter N and you ! 905: are finished. Otherwise (or if you don't want to bother to look ! 906: for an `IC' string) follow the remaining steps. ! 907: ! 908: 2. Output the `im' string, if there is one, unless the terminal is ! 909: already in insert mode. ! 910: ! 911: 3. Repeat steps 4 through 6, N times. ! 912: ! 913: 4. Output the `ic' string if any. ! 914: ! 915: 5. Output a space. ! 916: ! 917: 6. Output the `ip' string if any. ! 918: ! 919: 7. Output the `ei' string, eventually, to exit insert mode. There is ! 920: no need to do this right away. If the `mi' flag is present, you ! 921: can move the cursor and the cursor will remain in insert mode; ! 922: then you can do more insertion elsewhere without reentering insert ! 923: mode. ! 924: ! 925: To insert N graphic characters, position the cursor and follow this ! 926: algorithm: ! 927: ! 928: 1. If an `IC' string is provided, output it with parameter N, then ! 929: output the graphic characters, and you are finished. Otherwise ! 930: (or if you don't want to bother to look for an `IC' string) follow ! 931: the remaining steps. ! 932: ! 933: 2. Output the `im' string, if there is one, unless the terminal is ! 934: already in insert mode. ! 935: ! 936: 3. For each character to be output, repeat steps 4 through 6. ! 937: ! 938: 4. Output the `ic' string if any. ! 939: ! 940: 5. Output the next graphic character. ! 941: ! 942: 6. Output the `ip' string if any. ! 943: ! 944: 7. Output the `ei' string, eventually, to exit insert mode. There is ! 945: no need to do this right away. If the `mi' flag is present, you ! 946: can move the cursor and the cursor will remain in insert mode; ! 947: then you can do more insertion elsewhere without reentering insert ! 948: mode. ! 949: ! 950: Note that this is not the same as the original Unix termcap ! 951: specifications in one respect: it assumes that the `IC' string can be ! 952: used without entering insert mode. This is true as far as I know, and ! 953: it allows you be able to avoid entering and leaving insert mode, and ! 954: also to be able to avoid the inserted-character padding after the ! 955: characters that go into the inserted positions. ! 956: ! 957: Deletion of characters is less complicated; deleting one column is ! 958: done by outputting the `dc' string. However, there may be a delete ! 959: mode that must be entered with `dm' in order to make `dc' work. ! 960: ! 961: `dc' ! 962: String of commands to delete one character position at the cursor. ! 963: If `dc' is not present, the terminal cannot delete characters. ! 964: ! 965: `DC' ! 966: String of commands to delete N characters starting at the cursor. ! 967: It has the same effect as repeating the `dc' string N times. Any ! 968: terminal description that has `DC' also has `dc'. ! 969: ! 970: `dm' ! 971: String of commands to enter delete mode. If not present, there is ! 972: no delete mode, and `dc' can be used at any time (assuming there is ! 973: a `dc'). ! 974: ! 975: `ed' ! 976: String of commands to exit delete mode. This must be present if ! 977: `dm' is. ! 978: ! 979: To delete N character positions, position the cursor and follow these ! 980: steps: ! 981: ! 982: 1. If the `DC' string is present, output it with parameter N and you ! 983: are finished. Otherwise, follow the remaining steps. ! 984: ! 985: 2. Output the `dm' string, unless you know the terminal is already in ! 986: delete mode. ! 987: ! 988: 3. Output the `dc' string N times. ! 989: ! 990: 4. Output the `ed' string eventually. If the flag capability `mi' is ! 991: present, you can move the cursor and do more deletion without ! 992: leaving and reentering delete mode. ! 993: ! 994: As with the `IC' string, we have departed from the original termcap ! 995: specifications by assuming that `DC' works without entering delete mode ! 996: even though `dc' would not. ! 997: ! 998: If the `dm' and `im' capabilities are both present and have the same ! 999: value, it means that the terminal has one mode for both insertion and ! 1000: deletion. It is useful for a program to know this, because then it can ! 1001: do insertions after deletions, or vice versa, without leaving ! 1002: insert/delete mode and reentering it. ! 1003: ! 1004:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.