Contains compiled terminfo source files.
Terminfo is a compiled database describing the capabilities of terminals. Terminals are described in the terminfo source files via entries. Each entry contains information about the capabilities for a particular terminal or set of common terminals. Capabilities include the operations that can be performed, the padding requirements, cursor positioning, command sequences, and initialization sequences.
The compiled terminfo database is used by applications such as curses and vi that must have knowledge of the terminal but do not want to be terminal-dependent.
This article describes the terminfo source file format and covers the following topics:
An example of a terminfo source file is provided.
This article explains the terminfo source file format. Before a terminfo description can be used by applications, the terminfo source file it resides in must be compiled using the tic command. Using the tic command results in the creation of one or more binaries, one for each terminal. The collection of terminfo binaries in a directory (usually /usr/share/lib/terminfo) is known as the terminfo database, or terminfo.
You can edit or modify source files. A source file can contain one or more terminal descriptions or entries. A terminfo source file has a .ti suffix. Examples of source files are the /usr/share/lib/terminfo/ibm.ti file, which describes IBM terminals, and the /usr/share/lib/terminfo/dec.ti file, which describes DEC terminals.
See the infocmp command for obtaining the source description for a terminal when only the binary is available.
Each entry in a terminfo source file consists of a number of fields separated by commas. White space between commas is ignored. The following example shows a source file entry:
ibm6155-113|IBM 6155 Black & White display,
font0=\E[10m, font1=\E[11m, font2=\E[12m,
bold=\E[12m, sgr0=\E[0;10m,
cols#113, lines#38,
sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;12%;m,
blink@, use=ibm5151,
Entries can continue onto multiple lines by placing white space at the beginning of each subsequent line. To create a comment line, begin the line with a # (pound sign) character. To comment out an individual terminal capability, put a period before the capability name.
The first field (or line) for each terminal gives the various names by which the terminal is known, separated by | (pipe symbol) characters. The first name given should be the most common abbreviation for the terminal. (This name is the one most commonly used when setting the TERM environment variable.) The last name given should be a long name fully identifying the terminal. All other names are understood as synonyms for the terminal name. All names but the last should contain no blanks. The last name may contain blanks for readability. All names should be unique.
The remaining fields identify the terminal 's capabilities.
When choosing terminal names, there are some conventions you should follow. The root name should represent the particular hardware class of the terminal. Do not use hyphens in the root name, except to avoid synonyms that conflict with other names. To indicate possible modes for the hardware or user preferences, append a - (minus sign) and one of the following suffixes:
| Suffix | Meaning | Example |
|---|---|---|
| -am | With automatic margins (usually default) | Terminal-am |
| -m | Monochrome mode | Terminal-m |
| -w | Wide mode (more than 80 columns) | Terminal-w |
| -nam | Without automatic margins | Terminal-nam |
| -n | Number of lines on the screen | Terminal-60 |
| -na | No arrow keys (leave them in local) | Terminal-na |
| -np | Number of pages of memory | Terminal-4p |
| -rv | Reverse video | Terminal-rv |
| -s | Status line simulation. The terminal allows for one or more lines that are normally part of the screen to be used for the status line. This is not the same as terminals that have permanently dedicated status lines. | Terminal-s |
| -unk | Unknown mode. This entry can be used to define a general description of a terminal that has several of the modes described above. The other entries would use the unknown entry as a base description and add the appropriate customization. See the use= field. | Terminal-unk |
A terminal in 132-column mode would be Terminal-w.
A terminfo entry can define any number of capabilities. All capabilities belong to one of three types:
| Boolean | Indicates that the terminal has a particular feature. Boolean capabilities are true if the corresponding name is contained in the terminal description. |
| Numeric | Gives the size of the terminal or the size of particular delays. |
| String | Gives a sequence that can be used to perform particular terminal operations. |
This article provides tables that document the capability types. All the tables list the following:
| Variable | The name the application uses to access a capability. |
| Cap Name | The short capability name. This name is used in the terminfo database text and by the person creating or editing a source file entry. You can use the tput command to output the value of a capability for a particular terminal. |
| I.Code | The 2-letter internal code used in the compiled database. This code always corresponds to a termcap capability name. |
| Description | A description of the capability. |
Capability names have no absolute length limit. An informal limit of five characters is adopted to keep them short and to allow the tabs in the caps source file to be aligned. Whenever possible, names are chosen to be the same as or similar to the ANSI X3.64 standard of 1979.
For a detailed description of the various capabilities according to function, read:
A Boolean capability indicates that the terminal has some particular feature. For instance, the am capability in a terminal description indicates that the terminal has automatic margins (such as an automatic new line when the end of a line is reached). The following are the Boolean capabilities:
| Variable | Cap Name | I.Code | Description |
|---|---|---|---|
| auto_left_margin | bw | bw | Indicates cub1 wraps from column 0 to last column. |
| auto_right_margin | am | am | Indicates terminal has automatic margins. |
| back_color_erase | bce | ut | Erases screen with current background. |
| can_change | ccc | cc | Can redefine existing color. |
| ceol_standout_glitch | xhp | xs | Indicates that standout is not erased by overwriting. |
| col_addr_glitch | xhpa | YA | Indicates only positive motion for hpa/mhpa caps. |
| cpi_changes_res | cpix | YF | Indicates resolution changed when changing character pitch. |
| cr_cancels_micro_mode | crxm | YB | Indicates cr turns off micro mode. |
| dest_tabs_magic_smso (or teleray_glitch) | xt | xt | Indicates destructive tabs and blanks inserted while entering standout mode. |
| eat_newline_glitch | xenl | xn | Ignores new-line character after 80 columns. |
| erase_overstrike | eo | eo | Erases overstrikes with a blank. |
| generic_type | gn | gn | Indicates generic line type, such as, dialup or switch. |
| hard_copy | hc | hc | Indicates hardcopy terminal. |
| hard_cursor | chts | HC | Indicates cursor is hard to see. |
| has_meta_key | km | km | Indicates terminal has a meta key, such as shift or sets parity bit. |
| has_print_wheel | daisy | YC | Indicates operator needed to change character set. |
| has_status_line | hs | hs | Indicates terminal has a dedicated status line. |
| hue_lightness_saturation | hls | hl | Uses HLS color notation (Tektronix). |
| insert_null_glitch | in | in | Indicates insert mode distinguishes nulls. |
| lpi_changes_res | lpix | YG | Indicates resolution changed when changing line pitch. |
| memory_above | da | da | Display retained above the screen (usually multi-page terminals). |
| memory_below | db | db | Display retained below the screen (usually multi-page terminals) |
| move_insert_mode | mir | mi | Indicates safe to move while in insert mode. |
| move_standout_mode | msgr | ms | Indicates safe to move in standout modes. |
| needs_xon_xoff | nxon | nx | Indicates padding will not work, that xon/xoff is required. |
| no_esc_ctlc (or beehive_glitch) | xsb | xb | Indicates a terminal with F1=escape and F2=Ctrl-C. |
| no_pad_char | npc | NP | Indicates pad character does not exist. |
| non_dest_scroll_region | ndscr | ND | Indicates non-destructive scrolling region. |
| non_rev_rmcup | nrrmc | NR | Indicates smcup does not reverse rmcup. |
| over_strike | os | os | Indicates terminal overstrikes. |
| prtr_silent | mc5i | 5i | Indicates printer will not echo on screen. |
| row_addr_glitch | xvpa | YD | Indicates only positive motion for vpa/mvpa caps. |
| semi_auto_right_margin | sam | YE | Indicates printing in last column causes carriage return. |
| status_line_esc_ok | eslok | es | Indicates escape can be used on the status line. |
| tilde_glitch | hz | hz | Indicates terminal cannot print the ~ (tilde) character. |
| transparent_underline | ul | ul | Overstrikes with underline character. |
| xon_xoff | xon | xo | Indicates terminal uses xon/xoff handshaking. |
Numeric capabilities are followed by the # (pound sign) character and a numeric value. The cols#80 capability indicates the terminal has 80 columns. The following are the numeric capabilities:
| Variable | Cap Name | I.Code | Description |
|---|---|---|---|
| buffer_capacity | bufsz | Ya | Specifies the number of bytes buffered before printing. |
| columns | cols | co | Specifies the number of columns in a line. |
| dot_horz_spacing | spinh | Yc | Identifies the horizontal spacing of dots in dots per inch. |
| dot_vert_spacing | spinv | Yb | Specifies vertical spacing of pins in pins per inch. |
| init_tabs | it | it | Provides initial tabs every specified number of spaces. |
| label_height | lh | lh | Specifies the number of rows in each label. |
| label_width | lw | lw | Specifies the number of columns in each label. |
| lines | lines | li | Specifies the number of lines on screen or page. |
| lines_of_memory | lm | lm | Specifies the number of lines of memory if > lines. A value of 0 indicates a variable number. |
| magic_cookie_glitch | xmc | sg | Indicates number of blank characters left by smso or rmso. |
| max_attributes | ma | ma | Identifies the maximum combined video attributes the terminal can display. |
| max_colors | colors | Co | Specifies the maximum number of colors supported. |
| max_micro_address | maddr | Yd | Indicate the limit on use of mhpa and mvpa. |
| max_micro_jump | mjump | Ye | Specifies the limit on use of the mcub1, mcuf1, mcuu1, and mcud1 capabilities. |
| max_pairs | pairs | pa | Specifies the maximum number of color pairs supported. |
| maximum_windows | wnum | MW | Specifies the maximum number of defineable windows. |
| micro_char_size | mcs | Yf | Specifies the character step size when in micro mode. |
| micro_line_size | mls | Yg | Identifies the line step size when in micro mode. |
| no_color_video | ncv | NC | Indicates video attributes that cannot be used with colors. |
| num_labels | nlab | Nl | Specifies the number of labels on the screen. This value starts at 1. |
| number_of_pins | npins | Yh | Identifies the number of pins in the print-head. |
| output_res_char | orc | Yi | Specifies the horizontal resolution in units per character. |
| output_res_horz_inch | orhi | Yk | Specifies the horizontal resolution in units per inch. |
| output_res_line | orl | Yj | Specifies the vertical resolution in units per line. |
| output_res_vert_inch | orvi | Yl | Indicates vertical resolution in units per inch. |
| padding_baud_rate | pb | pb | Indicates lowest baud rate where carriage-return and line-return padding is needed. |
| print_rate | cps | Ym | Indicates print rate in characters per second. |
| virtual_terminal | vt | vt | Indicates virtual terminal number. |
| wide_char_size | widcs | Yn | Identifies the character step size when the terminal is in double-wide mode. |
| width_status_lines | wsl | ws | Specifies the number of columns in status lines. |
You define string-valued capabilities, such as the el capability (clear to end of line) with a 2-character code, an = (equal sign), and a string ending with a , (comma). A delay in milliseconds can appear anywhere in a string capability. To define a delay, enclose the delay between a $< and a >. The following shows the el capability with a delay of 3:
el=\EK$<3>
The tputs subroutine provides padding characters for a delay. A delay can be a number, such as 20, or a number followed by an * (asterisk), such as 3*. An asterisk indicates that the required padding is proportional to the number of lines affected by the operation. The number given represents the required padding for each affected unit. (For insert character, the factor is the number of lines affected, which is always 1, unless the terminal has the xenl capability and the software supports it). If you specify an asterisk, it is sometimes useful to give a delay of the form a.b, such as 3.5, to specify a delay for each unit to tenths of milliseconds. You can only specify one decimal place.
The terminfo database provides several escape sequences in the string-valued capabilities for easy encoding of characters. The following escape codes are recognized:
| Escape Code | Meaning |
|---|---|
| \E,\e | Escape |
| \n | New line |
| \l | Line feed |
| \r | Carriage return |
| \t | Tab |
| \b | Backspace |
| \f | Form feed |
| \s | Space |
| \^ | Caret |
| \\ | Backslash |
| \, | Comma |
| \: | Colon |
| \nnn | Character with octal value nnn |
| ^x | Ctrl-x for any appropriate x |
| \0 | Null character. \0 actually produces \200, which does not end a string but behaves as a null character on most terminals. |
The following conventions are used in the Description column of the String Capabilities table:
| Variable | Cap Name | I.Code | Description |
|---|---|---|---|
| appl_defined_str | apstr | za | Application-defined terminal string. |
| asc_chars | acsc | ac | Alternate character set mapping of glyph to characters. |
| back_tab | cbt | bt | Back tab. |
| bell | bel | bl | Produces an audible signal (bell). |
| box_chars_1 | box1 | bx | Box characters, primary set. |
| box_chars_2 | box2 | by | Box characters, alternate set. |
| box_attr_1 | batt1 | Bx | Attributes for box_chars_1. |
| box_attr_2 | batt2 | By | Attributes for box_chars_2. |
| carriage_return | cr | cr | Indicates carriage return. (*) |
| change_char_pitch | cpi | ZA | Change number of characters per inch. |
| change_line_pitch | lpi | ZB | Change number of lines per inch. |
| change_res_horz | chr | ZC | Change horizontal resolution. |
| change_res_vert | cvr | XD | Change vertical resolution. |
| char_padding | rmp | rP | Specifies character padding when in replace mode. |
| change_scroll_region | csr | cs | Changes scroll region to lines #1 through #2. (G) |
| char_set_names | csnm | Zy | List of character set names. |
| clear_all_tabs | tbc | ct | Clears all tab stops. |
| clear_margins | mgc | MC | Clear left and right soft margins. |
| clear_screen | clear | cl | Clears screen and puts cursor in home position. (*) |
| clr_bol | el1 | cb | Clear to beginning of line, inclusive. |
| clr_eol | el | ce | Clears to end of line. |
| clr_eod | ed | cd | Clears to end of the display.(*) |
| color_bg_0 | colb0 | d0 | Background color 0, black. |
| color_bg_1 | colb1 | d1 | Background color 1, red. |
| color_bg_2 | colb2 | d2 | Background color 2, green. |
| color_bg_3 | colb3 | d3 | Background color 3, brown. |
| color_bg_4 | colb4 | d4 | Background color 4, blue. |
| color_bg_5 | colb5 | d5 | Background color 5, magenta. |
| color_bg_6 | colb6 | d6 | Background color 6, cyan. |
| color_bg_7 | colb7 | d7 | Background color 7, white. |
| color_fg_0 | colf0 | c0 | Foreground color 0, black. |
| color_fg_1 | colf1 | c1 | Foreground color 1, red. |
| color_fg_2 | colf2 | c2 | Foreground color 2, green. |
| color_fg_3 | colf3 | c3 | Foreground color 3, brown. |
| color_fg_4 | colf4 | c4 | Foreground color 4, blue. |
| color_fg_5 | colf5 | c5 | Foreground color 5, magenta. |
| color_fg_6 | colf6 | c6 | Foreground color 6, cyan. |
| color_fg_7 | colf7 | c7 | Foreground color 7, white. |
| column_address | hpa | ch | Sets cursor column. (G) |
| command_character | cmdch | CC | Indicates that a terminal command-prototype character can be set. |
| create_window | cwin | CW | Define win #1 to go from #2, #3 to #4, #5. |
| cursor_address | cup | cm | Indicates screen-relative cursor motion row #1, col #2. (G) |
| cursor_down | cud1 | do | Moves cursor down one line. |
| cursor_home | home | ho | Moves cursor to home position (if no cup addressing). |
| cursor_invisible | civis | vi | Makes cursor invisible. |
| cursor_left | cub1 | le | Moves cursor left one space. |
| cursor_mem_address | mrcup | CM | Indicates memory relative cursor addressing. (G) |
| cursor_normal | cnorm | ve | Makes cursor appear normal (undo vs or vi). |
| cursor_right | cuf1 | nd | Indicates nondestructive space (cursor right). |
| cursor_to_ll | ll | ll | Moves cursor to first column of last line (if no cup addressing). |
| cursor_up | cuu1 | up | Moves cursor up one line. |
| cursor_visible | cvvis | vs | Makes cursor very visible. |
| define char | defc | ZE | Define a character in a character set. |
| delete_character | dch1 | dc | Deletes character. (*) |
| delete_line | dl1 | dl | Deletes line. (*) |
| dial_phone | dial | DI | Dial phone number #1. |
| dis_status_line | dsl | ds | Disables status line. |
| display_clock | dclk | DK | Display time-of-day clock. |
| down_half_line | hd | hd | Indicates subscript (forward 1/2 line feed). |
| ena_acs | enacs | eA | Enable alternate character set. |
| enter_alt_charset_mode | smacs | as | Starts alternate character set. |
| enter_am_mode | smam | SA | Turn on automatic margins. |
| enter_blink_mode | blink | mb | Enables blinking. |
| enter_bold_mode | bold | md | Enables bold (extra bright)mode. |
| enter_bottom_mode | btml | bm | Starts bottom line mode. This string capability is an aid for drawing tables and is valid only for aixterm and aixterm-m terminal definitions. |
| enter_ca_mode | smcup | ti | Begins programs that use cup addresing. |
| enter_delete_mode | smdc | dm | Starts delete mode. |
| enter_dim_mode | dim | mh | Enables half-bright mode. |
| enter_doublewide_mode | swidm | ZF | Enable double-wide printing. |
| enter_draft_quality | sdrfq | ZG | Set draft quality print. |
| enter_insert_mode | smir | im | Starts insert mode. |
| enter_italics_mode | sitm | ZH | Enable italics. |
| enter_leftward_mode | slm | Zl | Enable leftward carrige motion. |
| enter_lvert_mode | lvert | lv | Starts left vertical line mode. This string capability is an aid for drawing tables. Valid only for aixterm and aixterm-m terminal definitions. |
| enter_micro_mode | smicm | ZJ | Enable micro motion capabilities. |
| enter_near_letter_quality | snlq | ZK | Set near-letter quality print. |
| enter_normal_quality | snrmq | ZL | Set normal quality print. |
| enter_protected_mode | prot | mp | Enables protected mode. |
| enter_reverse_mode | rev | mr | Enables reverse video mode. |
| enter_rvert_mode | rvert | rv | Starts right vertical line mode. This string capability is an aid for drawing tables and is valid only for aixterm and aixterm-m terminal definitions. |
| enter_secure_mode | invis | mk | Enables blank mode (characters are invisible). |
| enter_shadow_mode | sshm | ZM | Enable shadow printing. |
| enter_standout_mode | smso | so | Begins standout mode. |
| enter_subscript_mode | ssubm | ZN | Enable subscript printing. |
| enter_superscript_mode | ssupm | ZO | Enable superscript printing. |
| enter_topline_mode | topl | tp | Starts top line mode. This string capability is an aid for drawing tables and is valid only for aixterm and aixterm-m terminal definitions. |
| enter_underline_mode | smul | us | Starts underscore mode. |
| enter_upward_mode | sum | ZP | Enable upward carriage motion. |
| enter_xon_mode | smxon | SX | Turn on xon/xoff handshaking. |
| erase_chars | ech | ec | Erases #1 characters. (G) |
| exit_alt_charset_mode | rmacs | ae | Ends alternate character set. |
| exit_am_mode | rmam | RA | Turn off automatic margins. |
| exit_attribute_mode | sgr0 | me | Disables all attributes. |
| exit_ca_mode | rmcup | te | Ends programs that use cup addressing. |
| exit_delete_mode | rmdc | ed | Ends delete mode. |
| exit_doublewide_mode | rwidm | ZQ | Disable double-wide printing. |
| exit_insert_mode | rmir | ei | Ends insert mode. |
| exit_italics_mode | ritm | ZR | Disable italics. |
| exit_leftward_mode | rlm | ZS | Enable rightward (normal) carriage motion. |
| exit_micro_mode | micm | ZT | Disable micro motion capabilities. |
| exit_shadow_mode | rshm | ZU | Disable shadow printing. |
| exit_standout_mode | rmso | se | Ends standout mode. |
| exit_subscript_mode | rsubm | ZV | Disable subscript printing. |
| exit_superscript_mode | rsupm | ZW | Disable superscript printing. |
| exit_underline_mode | rmul | ue | Ends underscore mode. |
| exit_upward_mode | rum | ZX | Enable downard (normal) carrige motion. |
| exit_xon_mode | rmxon | RX | Turn off xon/xoff handshaking. |
| flash_screen | flash | vb | Indicates visual bell (may not move cursor). |
| fixed_pause | pause | PA | Pause for 2-3 seconds. |
| flash_hook | hook | fh | Flash the switch hook. |
| font_0 | font0 | f0 | Select font 0. |
| font_1 | font1 | f1 | Select font 1. |
| font_2 | font2 | f2 | Select font 2. |
| font_3 | font3 | f3 | Select font 3. |
| font_4 | font4 | f4 | Select font 4. |
| font_5 | font5 | f5 | Select font 5. |
| font_6 | font6 | f6 | Select font 6. |
| font_7 | font7 | f7 | Select font 7. |
| form_feed | ff | ff | Ejects page (hardcopy terminal). (*) |
| from_status_line | fsl | fs | Returns from status line. |
| goto_window | wingo | WG | Go to window #1. |
| hangup | hup | HU | Hang-up phone. |
| init_1string | is1 | i1 | Initializes terminal. |
| init_2string | is2 | is | Initializes terminal. |
| init_3string | is3 | i3 | Initializes terminal. |
| init_file | if | if | Identifies file containing is long initialization strings. |
| init_prog | iprog | iP | Locates the program for initialization. |
| initialize_color | initc | Ic | Initialize the color definition. |
| initialize_pair | initp | Ip | Initialize color pair. |
| insert_character | ich1 | ic | Inserts character. |
| insert_line | il1 | al | Adds new blank line. (*) |
| insert_padding | ip | ip | Inserts pad after character inserted. (*) |
| key_a1 | ka1 | K1 | Specifies upper left of keypad. |
| key_a3 | ka3 | K3 | Specifies upper right of keypad. |
| key_action | kact | kJ | Sent by action key. |
| key_b2 | kb2 | K2 | Specifies center of keypad. |
| key_backspace | kbs | kb | Sent by backspace key. |
| key_beg | kbeg | @1 | Beginning key. KEY_BEG |
| key_btab | kcbt | kB | Sent by backtab key. KEY_BTAB |
| key_c1 | kc1 | K4 | Specifies lower left of keypad. |
| key_c3 | kc3 | K5 | Specifies lower right of keypad. |
| key_cancel | kcan | @2 | Cancel key. KEY_CANCEL |
| key_catab | ktbc | ka | Sent by clear-all-tabs key. |
| key_clear | kclr | kC | Sent by clear screen or erase key. |
| key_close | kclo | @3 | Close key. KEY_CLOSE |
| key_command | kcmd | @4 | Command-request key. |
| key_command_pane | kcpn | @7 | Command-pane key. |
| key_copy | kcpy | @5 | Copy key. KEY_COPY |
| key_create | kcrt | @6 | Create key. KEY_CREATE |
| key_ctab | kctab | kt | Sent by clear tab key. |
| key_dc | kdch1 | kD | Sent by delete-character key. |
| key_dl | kdl1 | kL | Sent by delete-line key. |
| key_do | kdo | ki | Do request key. |
| key_down | kcud1 | kd | Sent by terminal down-arrow key. |
| key_eic | krmir | kM | Sent by rmir or smir in insert mode. |
| key_end | kend | @7 | End key. KEY_END |
| key_enter | kent | @8 | Enter/send (unreliable). KEY_ENTER. |
| key_eol | kel | kE | Sent by clear-to-end-of-line key. |
| key_eos | ked | kS | Sent by clear-to-end-of-screen key. |
| key_exit | kext | @9 | Exit key. KEY_EXIT. |
| key_f0 | kf0 | k0 | Sent by function key F0. |
| key_f1 | kf1 | k1 | Sent by function key F1. |
| key_f2 | kf2 | k2 | Sent by function key F2. |
| key_f3 | kf3 | k3 | Sent by function key F3. |
| key_f4 | kf4 | k4 | Sent by function key F4. |
| key_f5 | kf5 | k5 | Sent by function key F5. |
| key_f6 | kf6 | k6 | Sent by function key F6. |
| key_f7 | kf7 | k7 | Sent by function key F7. |
| key_f8 | kf8 | k8 | Sent by function key F8. |
| key_f9 | kf9 | k9 | Sent by function key F9. |
| key_f10 | kf10 | k; | Sent by function key F10. |
| key_f11 | kf11 | F1 | Sent by function key F11. |
| key_f12 | kf12 | F2 | Sent by function key F12. |
| key_f13 | kf13 | F3 | Sent by function key F13. KEY_F(13) |
| key_f14 | kf14 | F4 | Sent by function key F14. KEY_F(14) |
| key_f15 | kf15 | F5 | Sent by function key F15. KEY_F(15) |
| key_f16 | kf16 | F6 | Sent by function key 16. KEY_F(16) |
| key_f17 | kf17 | F7 | Sent by function key 17. KEY_F(17) |
| key_f18 | kf18 | F8 | Sent by function key 18. KEY_F(18) |
| key_f19 | kf19 | F9 | Sent by function key 19. KEY_F(19) |
| key_f20 | kf20 | FA | Sent by function key 20. KEY_F(20) |
| key_f21 | kf21 | FB | Sent by function key 21. KEY_F(21) |
| key_f22 | kf22 | FC | Sent by function key 22. KEY_F(22) |
| key_f23 | kf23 | FD | Sent by function key 23. KEY_F(23) |
| key_f24 | kf24 | FE | Sent by function key 24. KEY_F(24) |
| key_f25 | kf25 | FF | Sent by function key 25. KEY_F(25) |
| key_f26 | kf26 | FG | Sent by function key 26. KEY_F(26) |
| key_f27 | kf27 | FH | Sent by function key 27. KEY_F(27), 03543 |
| key_f28 | kf28 | FI | Sent by function key 28. KEY_F(28) |
| key_f29 | kf29 | FJ | Sent by function key 29. KEY_F(29) |
| key_f30 | kf30 | FK | Sent by function key 30. KEY_F(30) |
| key_f31 | kf31 | FL | Sent by function key 31. KEY_F(31) |
| key_f32 | kf32 | FM | Sent by function key 32. KEY_F(32) |
| key_f33 | kf33 | FN | Sent by function key 33. KEY_F(33) |
| key_f34 | kf34 | FO | Sent by function key 34. KEY_F(34) |
| key_f35 | kf35 | FP | Sent by function key 35. KEY_F(35) |
| key_f36 | kf36 | FP | Sent by function key 36. KEY_F(36) |
| key_f37 | kf37 | FQ | Sent by function key 37. KEY_F(37) |
| key_f38 | kf38 | FR | Sent by function key 38. KEY_F(38) |
| key_f39 | kf39 | FS | Sent by function key 39. KEY_F(39) |
| key_f40 | kf40 | FT | Sent by function key 40. KEY_F(40) |
| key_f41 | kf41 | FU | Sent by function key 41. KEY_F(41) |
| key_f42 | kf42 | FV | Sent by function key 42. KEY_F(42) |
| key_f43 | kf43 | FW | Sent by function key 43. KEY_F(43) |
| key_f44 | kf44 | FX | Sent by function key 44. KEY_F(44) |
| key_f45 | kf45 | FY | Sent by function key 45. KEY_F(45) |
| key_f46 | kf46 | FZ | Sent by function key 46. KEY_F(46) |
| key_f47 | kf47 | Fa | Sent by function key 47. KEY_F(47) |
| key_f48 | kf48 | Fb | Sent by function key 48. KEY_F(48) |
| key_f49 | kf49 | Fc | Sent by function key 49. KEY_F(49) |
| key_f50 | kf50 | Fd | Sent by function key 50. KEY_F(50) |
| key_f51 | kf51 | Fe | Sent by function key f51. KEY_F(51) |
| key_f52 | kf52 | Ff | Sent by function key f52. KEY_F(52) |
| key_f53 | kf53 | Fg | Sent by function key f53. KEY_F(53) |
| key_f54 | kf54 | Fi | Sent by function key f54. KEY_F(54) |
| key_f55 | kf55 | Fj | Sent by function key f55. KEY_F(55) |
| key_f56 | kf56 | Fk | Sent by function key f56. KEY_F(56) |
| key_f57 | kf57 | Fl | Sent by function key f57. KEY_F(57) |
| key_f58 | kf58 | Fm | Sent by function key f58. KEY_F(58) |
| key_f59 | kf59 | Fn | Sent by function key f59. KEY_F(59) |
| key_f60 | kf60 | Fo | Sent by function key f60. KEY_F(60) |
| key_f61 | kf61 | Fp | Sent by function key f61. KEY_F(61) |
| key_f62 | kf62 | Fq | Sent by function key f62. KEY_F(62) |
| key_f63 | kf63 | Fr | Sent by function key f63. KEY_F(63) |
| key_find | kfnd | @0 | Find key. KEY_FIND |
|
|
|
|
|
| key_help | khlp | kq | Help key. |
| key_home | khome | kh | Sent by home key. |
| key_ic | kich1 | kI | Sent by insert-character/ enter-insert-mode key. |
| key_il | kil1 | kA | Sent by insert line key. |
| key_left | kcub1 | kl | Sent by terminal left-arrow key. |
| key_ll | kll | kH | Sent by home-down key. |
| key_mark | kmrk | %2 | Mark key. KEY_MARK |
| key_message | kmsg | %3 | Message key. KEY_MESSAGE |
| key_move | kmov | %4 | Move key. KEY_MOVE |
| key_newline | knl | kn | New-line key. |
| key_next | knxt | %5 | Next object key. KEY_NEXT |
| key_next_pane | knpn | kv | Next-pane key. |
| key_npage | knp | kN | Sent by next-page key. |
| key_open | kopn | %6 | Open key. KEY_OPEN |
| key_options | kopt | %7 | Options key. KEY_OPTIONS |
| key_ppage | kpp | kP | Sent by previous-page key. |
| key_prev_pane | kppn | kV | Sent by previous-pane key. |
| key_prev_cmd | kpcmd | kp | Sent by previous-command key. |
| key_previous | kprv | %8 | Previous object key. KEY_PREVIOUS |
| key_print | kprt | %9 | Print or copy. KEY_PRINT |
| key_quit | kquit | kQ | Quit key. |
| key_redo | krdo | %0 | Redo key. KEY_REDO |
| key_reference | kref | &1 | Reference key. KEY_REFERENCE |
| key_refresh | krfr | &2 | Refresh key. KEY_REFRESH |
| key_replace | krpl | &3 | Replace key. KEY_REPLACE |
| key_restart | krst | &4 | Restart key. KEY_RESTART |
| key_resume | kres | &5 | Resume key. KEY_RESUME |
| key_right | kcuf1 | kr | Sent by terminal right-arrow key. |
| key_save | ksav | &6 | Save key. KEY_SAVE |
| key_sbeg | kBEG | &9 | Shifted beginning key. KEY_SBEG |
| key_scancel | kCAN | &0 | Shifted cancel key. KEY_SCANCEL |
| key_scommand | kCMD | *1 | Shifted command key. KEY_SCOMMAND |
| key_scopy | kCPY | *2 | Shifted copy key. KEY_SCOPY |
| key_screate | kCRT | *3 | Shifted create key. KEY_SCREATE |
| key_scroll_left | kscl | kz | Scroll left. |
| key_scroll_right | kscr | kZ | Scroll right. |
| key_sdc | kDC | *4 | Shifted delete-character key. KEY_SDC |
| key_sdl | kDL | *5 | Shifted delete-line key. KEY_SDL |
| key_select | kslt | *6 | Select key. |
| key_send | kEND | *7 | Shifted end key. KEY_SEND |
| key_seol | kEOL | *8 | Shifted clear-line key. KEY_SEOL |
| key_sexit | kEXT | *9 | Shifted exit key. KEY_SEXIT |
| key_sf | kind | kF | Sent by scroll-forward/ scroll-down key. |
| key_sf1 | ksf1 | S1 | Special function key 1. |
| key_sf2 | ksf2 | S2 | Special function key 2. |
| key_sf3 | ksf3 | S3 | Special function key 3. |
| key_sf4 | ksf4 | S4 | Special function key 4. |
| key_sf5 | ksf5 | S5 | Special function key 5. |
| key_sf6 | ksf6 | S6 | Special function key 6. |
| key_sf7 | ksf7 | S7 | Special function key 7. |
| key_sf8 | ksf8 | S8 | Special function key 8. |
| key_sf9 | ksf9 | S9 | Special function key 9. |
| key_sf10 | ksf10 | S0 | Special function key 10. |
| key_sfind | kFND | *0 | Shifted find key. KEY_SFIND |
| key_shelp | kHLP | #1 | Shifted help key. KEY_SHELP |
| key_shome | kHOM | #2 | Shifted home key. KEY_SHOME |
| key_sic | kIC | #3 | Shifted input key. KEY_SIC |
| key_sleft | kLFT | #4 | Shifted left-arrow key. KEY_SLEFT |
| key_smap_in1 | kmpf1 | Kv | Input for special mapped key 1. |
| key_smap_in2 | kmpf2 | Kw | Input for special mapped key 2. |
| key_smap_in3 | kmpf3 | Kx | Input for special mapped key 3. |
| key_smap_in4 | kmpf4 | Ky | Input for special mapped key 4. |
| key_smap_in5 | kmpf5 | Kz | Input for special mapped key 5. |
| key_smap_in6 | kmpf6 | Kr | Input for special mapped key 6. |
| key_smap_in7 | kmpf7 | Ks | Input for special mapped key 7. |
| key_smap_in8 | kmpf8 | Kt | Input for special mapped key 8. |
| key_smap_in9 | kmpf9 | Ku | Input for special mapped key 9. |
| key_smap_out1 | kmpt1 | KV | Output for mapped key 1. |
| key_smap_out2 | kmpt2 | KW | Output for mapped key 2. |
| key_smap_out3 | kmpt3 | KX | Output for mapped key 3. |
| key_smap_out4 | kmpt4 | KY | Output for mapped key 4. |
| key_smap_out5 | kmpt5 | KZ | Output for mapped key 5. |
| key_smap_out6 | kmpt6 | KR | Output for mapped key 6. |
| key_smap_out7 | kmpt7 | KS | Output for mapped key 7. |
| key_smap_out8 | kmpt8 | KT | Output for mapped key 8. |
| key_smap_out9 | kmpt9 | KU | Output for mapped key 9. |
| key_smessage | kMSG | %a | Shifted message key. KEY_SMESSAGE |
| key_smove | kMOV | %b | Shifted move key. KEY_SMOVE |
| key_snext | kNXT | %c | Shifted next key. KEY_SNEXT |
| key_soptions | kOPT | %d | Shifted options key. KEY_SOPTIONS |
| key_sprevious | kPRV | %e | Shifted previous key. KEY_SPREVIOUS |
| key_sprint | kPRT | %f | Shifted print key. KEY_SPRINT |
| key_sr | kri | kR | Sent by scroll-backward key. |
| key_redo | kRDO | %g | Shifted redo key. KEY_SREDO |
| key_replace | kRPL | %h | Shifted replace key. KEY_REPLACE |
| key_sright | kRIT | %i | Shifted right-arrow key. KEY_SRIGHT |
| key_srsume | kRES | %j | Shifted resume key. KEY_SRSUME |
| key_ssave | kSAV | !1 | Shifted save key. KEY_SSAVE |
| key_ssuspend | kSPD | !2 | Shifted suspend key. KEY_SSUPEND |
| key_stab | khts | kT | Sent by set-tab key. |
| key_sundo | kUND | !3 | Shifted undo key. KEY_SUNDO |
| key_suspend | kspd | &7 | Suspend key. KEY_SUSPEND |
| key_tab | ktab | ko | Tab key. |
| key_undo | kund | &8 | Undo key. KEY_UNDO |
| key_up | kcuu1 | ku | Sent by terminal up-arrow key. |
| keypad_local | rmkx | ke | Ends keypad transmit mode. |
| keypad_xmit | smkx | ks | Puts terminal in keypad transmit mode. |
| lab_f0 | lf0 | l0 | Labels function key F0, if not F0. |
| lab_f1 | lf1 | l1 | Labels function key F1, if not F1. |
| lab_f2 | lf2 | l2 | Labels function key F2, if not F2. |
| lab_f3 | lf3 | l3 | Labels function key F3, if not F3. |
| lab_f4 | lf4 | l4 | Labels function key F4, if not F4. |
| lab_f5 | lf5 | l5 | Labels function key F5, if not F5. |
| lab_f6 | lf6 | l6 | Labels function key F6, if not F6. |
| lab_f7 | lf7 | l7 | Labels function key F7, if not F7. |
| lab_f8 | lf8 | l8 | Labels function key F8, if not F8. |
| lab_f9 | lf9 | l9 | Labels function key F9, if not F9. |
| lab_f10 | lf10 | la | Labels function key F10, if not F10. |
| label_format | fln | Lf | Label format. |
| label_off | rmln | LF | Turn off soft labels. |
| label_on | smln | LO | Turn on soft labels. |
| meta_on | smm | mm | Enables meta mode (8th bit). |
| meta_off | rmm | mo | Disables meta mode. |
| micro_column_address | mhpa | ZY | Move N steps from the left. |
| micro_down | mcud1 | ZZ | Move 1 step down. |
| micro_left | mcub1 | Za | Move 1 step left. |
| micro_right | mcuf1 | Zb | Move 1 step right. |
| micro_row_address | mvpa | Zc | Move N steps from the top. |
| micro_up | mcuu1 | Zd | Move 1 step up. |
| newline | nel | nw | Performs new-line function (behaves like carriage return followed by line feed). |
| order_of_pins | porder | Ze | Matches software bits to print-head pins. |
| orig_colors | oc | oc | Original colors. |
| orig_pair | op | op | Original color-pair. |
| pad_char | pad | pc | Pads character (instead of NULL). |
| parm_dch | dch | DC | Deletes #1 characters. (G) |
| parm_delete_line | dl | DL | Deletes #1 lines. (G) |
| parm_down_cursor | cud | DO | Moves cursor down #1 lines. (G*) |
| parm_down_micro | mcud | Zf | Move N steps down. (G*) |
| parm_ich | ich | IC | Inserts #1 blank characters. (G*) |
| parm_index | indn | SF | Scrolls forward #1 lines. (G) |
| parm_insert_line | il | AL | Adds #1 new blank lines. (G*) |
| parm_left_cursor | cub | LE | Moves cursor left #1 spaces. (G) |
| parm_left_micro | mcub | Zg | Move N steps left. |
| parm_right_cursor | cuf | RI | Moves cursor right #1 spaces. (G*) |
| parm_right_micro | mcuf | Zh | Move N steps right. |
| parm_rindex | rin | SR | Scrolls backward #1 lines. (G) |
| parm_up_cursor | cuu | UP | Moves cursor up #1 lines. (G*) |
| parm_up_micro | mcuu | Zi | Move N steps up. |
| pkey_key | pfkey | pk | Programs function key #1 to type string #2. |
| pkey_local | pfloc | pl | Programs function key #1 to execute string #2. |
| pkey_xmit | pfx | px | Programs function key #1 to transmit string #2. |
| plab_norm | pln | pn | Program label #1 to show string #2. |
| print_screen | mc0 | ps | Prints contents of the screen. |
| prtr_non | mc5p | pO | Enables the printer for #1 bytes. |
| prtr_off | mc4 | pf | Disables the printer. |
| prtr_on | mc5 | po | Enables the printer. |
| pulse | pulse | PU | Select pulse dialing. |
| quick_dial | qdial | QD | Dial phone number #1, without progress detection. |
| remove_clock | rmclk | RC | Remove time-of-day clock. |
| repeat_char | rep | rp | Repeats #1 character #2 times. (G*) |
| req_for_input | rfi | RF | Send next input char (for pty's). |
| reset_1string | rs1 | r1 | Resets terminal to known modes. |
| reset_2string | rs2 | r2 | Resets terminal to known modes. |
| reset_3string | rs3 | r3 | Resets terminal to known modes. |
| reset_file | rf | rf | Identifies the file containing reset string. |
| restore_cursor | rc | rc | Restores cursor to position of last sc (save_cursor). |
| row_address | vpa | cv | Positions cursor to an absolute vertical position (set row). (G) |
| save_cursor | sc | sc | Saves cursor position. |
| scroll_forward | ind | sf | Scrolls text up. |
| scroll_reverse | ri | sr | Scrolls text down. |
| select_char_set | scs | Zj | Select character set. |
| set_attributes | sgr | sa | Defines the video attributes. (G) #1-#9 |
| set_background | setb | Sb | Set background color. |
| set_bottom_margin | smgb | Zk | Set soft bottojm margin at current line. |
| set_bottom_margin_parm | smgbp | Zl | Set soft bottom margin. |
| set_clock | sclk | SC | Set time-of-day clock. |
| set_color_pair | scp | sp | Set color pair. |
| set_foreground | setf | Sf | Set foreground color. |
| set_left_margin | smgl | ML | Set soft left margin. |
| set_left_margin_parm | smglp | Zm | Set soft left margin. |
| set_right_margin | smgr | MR | Set soft right margin. |
| set_right_margin_parm | smgrp | Zn | Set soft right margin. |
| set_tab | hts | st | Sets a tab in every row of the current column. |
| set_top_margin | smgt | Zo | Set top margin at current line. |
| set_top_margin_parm | smgtp | Zp | Set soft top margin. |
| set_window | wind | wi | Indicates current window is lines #1-#2, columns #3-#4. (G) |
| start_bit_image | sbim | Zq | Start printing bit-image graphics. |
| start_char_set_def | scsd | Zr | Start definition of a character set. |
| stop_bit_image | rbim | Zs | End printing bit image graphics. |
| stop_char_set_def | rcsd | Zt | End definition of a character set. |
| subscript_characters | subcs | Zu | List of charcters that can appear in subscript. |
| superscript_characters | supcs | Zv | List of characters that can appear in superscript. |
| tab | ht | ta | Tabs to next 8-space hardware tab stop. |
| these_cause_cr | docr | Zw | Printing any of these characters cause a carrige return. |
| tone | tone | TO | Select touch-tone dialing. |
| to_status_line | tsl | ts | Moves to status line, column #1. (G) |
| underline_char | uc | uc | Underscores one character and moves beyond it. |
| up_half_line | hu | hu | Indicates superscript (reverse 1/2 line-feed) |
| user0 | u0 | u0 | User string 0. |
| user1 | u1 | u1 | User string 1. |
| user2 | u2 | u2 | User string 2. |
| user3 | u3 | u3 | User string 3. |
| user4 | u4 | u4 | User string 4. |
| user5 | u5 | u5 | User string 5. |
| user6 | u6 | u6 | User string 6. |
| user7 | u7 | u7 | User string 7. |
| user8 | u8 | u8 | User string 8. |
| user9 | u9 | u9 | User string 9. |
| wait_tone | wiat | WA | Wait for dial tone. |
| xoff_character | xoffc | XF | X-off character. |
| xon_character | xonc | XN | X-on character. |
| zero_motion | zerom | Zx | No motion for the subsequent character. |
You can create a terminal description by copying and then modifying the description of a similar terminal. You can check the accuracy of your partial descriptions with the vi editor. Some terminals may reveal bugs in the vi editor as well as deficiencies in the ability of the terminfo database to provide a terminal description.
To test a new terminal description, set the TERMINFO environment variable to the path name of the directory containing the compiled description on which you are working. Programs then check that directory instead of the /usr/share/lib/terminfo directory.
To test for correct padding (if known), do the following:
If the terminal fails to display the result properly, more padding is usually needed. You can perform a similar test for insert character.
This section describes some basic terminal capabilities. If a terminal supports one of these capabilities, the terminal's terminfo source file entry indicates it. The following list is a list of basic capabilities:
| am | Indicates that the cursor moves to the beginning of the next line when it reaches the right margin. This capability also indicates whether the cursor can move beyond the bottom right corner of the screen. |
| bel | Produces an audible signal (such as a bell or a beep). |
| bw | Indicates that a backspace from the left edge of the terminal moves the cursor to the last column of the previous row. |
| clear | Clears the screen, leaving the cursor in the home position. |
| cols | Specifies the number of columns on each line for the terminal. |
| cr | Moves the cursor to the left edge of the current row. This code is usually carriage return (Ctrl-M). |
| cub1 | Moves the cursor one space to the left, such as backspace. |
| cuf1 | Moves the cursor to the right one space. |
| cuu1 | Moves the cursor up one space. |
| cud1 | Move the cursor down one space. |
| hc | Specifies a printing terminal with no softcopy unit. You should also specify the os capability. |
| ind | Scrolls text up. |
| lf | Specifies a line-feed. |
| lines | Specifies the number of lines on a cathode ray tube (CRT) terminal. |
| nel | Specifies a newline. The terminal behaves as if it received a carriage return followed by a line feed. |
| os | Indicates that when a character is displayed or printed in a position already occupied by another character, the terminal overstrikes the existing character, rather than replacing it with the new character. The os capability applies to storage scope, printing, and APL terminals. |
| ri | Scrolls text down. |
If the LINES and COLUMNS environment variables are set, these variables override the values in the terminfo database.
The local cursor motions encoded in the terminfo database files are undefined at the left and top edges of a CRT terminal. Programs should never attempt to backspace around the left edge (unless the bw string is given) or to go up locally off the top.
To scroll text up, a program should go to the bottom left corner of the screen and send the index string. To scroll text down, a program goes to the top left corner of the screen and sends the reverse index string. The index string is specified by the ind capability and the reverse index string is specified by the ri capability. The index string and the reverse index string are undefined when not on their respective corners of the screen.
The am capability determines whether the cursor sticks at the right edge of the screen when text is output, but this does not necessarily apply when the cursor is moved to the right (the cuf1 capability) from the last column. A terminal has local motion from the left edge only if the bw capability is defined. The cursor then goes to the right edge of the previous row when moved to the left (the cub1 capability) from the left edge. If the terminal does not have the bw capability, the effect is undefined, which is useful for drawing a box around the edge of the screen, for example.
A terminal has switch-selectable automatic margins if the am capability is specified. If the terminal has a command that moves to the first column of the next line, you can define the nel (new-line) capability. It does not matter whether the command clears the remainder of the current line. Therefore, if the terminal has no cr and lf, a working nel can still be crafted out of one or both of them.
These capabilities suffice to describe printing terminals and simple CRT terminals. Thus, the Model 33 Teletype is described as:
33 | tty33 | tty | Model 33 Teletype
bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os, xon,
Another terminal is described as:
xxxx | x | xxxxxxxx,
am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,
ind=^J, lines#24,
Cursor-addressing and other strings requiring parameters are described by parameterized string capabilities. These strings have escape sequences similar to the printf %x format. For example, to address the cursor, you specify the cup capability using the row and column parameters.
The parameterized capabilities include:
| cub1 | Backspaces the cursor one space. |
| cup | Addresses the cursor using the row and column parameters. Rows and columns are numbered starting with 0 and refer to the physical screen visible to the user, not to memory. |
| hpa and vpa | Indicates the cursor has row or column absolute cursor addressing:
horizontal position absolute (hpa) or vertical absolute
(vpa).
Sometimes the hpa and vpa capabilities are shorter than the more general two-parameter sequence and you can use them in preference to the cup capability. Parameterized local motions (such as, a move of n spaces to the right) are defined with the cud, cub, cuf, and cuu capabilities, with a single parameter indicating how many spaces to move. These capabilities are primarily useful if the terminal does not have cup capability. |
| indn and rin | Scrolls text. These are parameterized versions of the basic ind and ri capabilities. The n value is a number of lines. |
| mrcup | Indicates the terminal has memory-relative cursor addressing. |
The parameter mechanism uses a stack and has special % (percent sign) codes to manipulate the stack. Typically, a sequence pushes one of the parameters onto the stack and then prints it in some format. Often, more complex operations are necessary. The encodings have the following meanings:
| %% | Outputs a % (percent sign). |
| %[ [:] Flags] [Width [.Precision] ] [doxXs] | As in the printf command, flags are the [- + # ] and space. |
| %d | Prints pop() as in the printf command (numeric string from stack). |
| %2d | Prints pop() like %2d (minimum 2 digits output from stack). |
| %3d | Prints pop() like %3d (minimum 3 digits output from stack). |
| %02d | Prints as in the printf command (2 digits output). |
| %03d | Prints as in the printf command (3 digits output). |
| %c | Prints pop() gives %c (character output from stack). |
| %s | Prints pop() gives %s (string output from stack). |
| %p[i] | Pushes the ith parameter onto the stack where i is a number between 1 and 9. |
| %P[a-z] | Sets variable [a-z] to pop() (variable output from stack). |
| %g[a-z] | Gets variable [a-z] and pushes it onto the stack. |
| %'c' | Character constant c. |
| %{nn} | Integer constant nn. |
| %l | Push strlen (pop( )) |
| %+ %- %* %/ %m | Arithmetic operators (%m is modulus): push (pop() operation pop()). |
| %& %| %^ | Bit operations: push (pop() operation pop()). |
| %= %> %< | Logical operations: push (pop() operation pop()). |
| %! %~ | Unary operations: push (operation pop()). |
| %i | Add 1 to first two parameters (for ANSI terminals). |
| %?expr %t thenpart %e elsepart %; | If-then-else. The %e elsepart is optional. You can make an else-if construct as with Algol 68 in the
following example, where ci denotes conditions and bi bodies.
%? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e b4 %; |
Binary operations are in postfix form with the operands in the usual order. That is, to get x - 5 use %gx%{5}%-.
If you use the - (minus sign) flag with %[doxXs], then you must place a colon between the % (percent sign) and the - (minus sign) to differentiate the flag from the %- binary operation, for example, %:-16.16s.
Consider a terminal that needs to be sent \E&a12c03Y padded for 6 milliseconds to get to row 3 and column 12. Here the order of the rows and columns is inverted, and the row and column are zero-padded as two digits. Thus, the cup capability of this terminal is cup=\E&a%p2%2.2dc%p1%2.2dY$<6>.
Some terminals need the current row and column sent, preceded by a ^T, with the row and column encoded in binary: cup=^T%p1%c%p2%c. Terminals that use %c need to be able to backspace the cursor (cub1) and to move the cursor up one line on the screen (cuu1). This is necessary because it is not always safe to transmit \n, ^D, and \r characters, since the system may change or discard them.
A final example is a terminal that uses row and column offset by a blank character: cup=\E=%p1%'\s'%+%c%p2'\s'%+%c. After sending \E=, this operation pushes the first parameter, pushes the ASCII value for a space (32), adds them (pushing the sum on the stack in place of the two previous values), and outputs that value as a character. Then the same is done for the second parameter. More complex arithmetic is possible using the stack.
The top left corner of the screen is the home position. If the terminal has a fast way to get the cursor to the home position, specify the home capability. Specify, a fast way of getting to the bottom left corner with the ll capability. This method may involve going up (cuu1) from the home position, but a program should never do this itself (unless ll does) because the effect of moving up from the home position is not certain.
If the terminal has row or column absolute-cursor addressing, you should specify the single hpa capability (horizontal position above) and the vpa capability (vertical position absolute). Sometimes these are shorter than the more general two parameter sequence and you can use them instead of the cup capability.
If the terminal has parameterized local motions for example, it is capable of moving the cursor n spaces right, you can specify the cud, cub, cuf, and cuu capabilities with a single parameter indicating how many spaces to move. These capabilities are useful if the terminal does not have the cup capability.
The following capabilities clear large areas of the terminal:
| ed | Clears from the current position to the end of the display. This is defined only from the first column of a line. (Thus, it can be simulated by a request to delete a large number of lines, if a true ed is not available.) |
| el | Clears from the current cursor position to the end of the line without moving the cursor. |
| el1 | Clears from the beginning of the line to the current position, inclusive. The cursor is not moved. |
The following insert-line and delete-line capabilities are used to indicate a terminal can:
A terminal that has the csr capability can scroll part of its screen while leaving other lines above and below the region untouched. A forward scroll applied to a region deletes the top of the region, shifts, and adds a line to the bottom of the region. When finished with the scrolling region, you should use the csr capability to restore the scrolling region to the full screen.
Be sure you move the cursor into the scrolling region with the cup capability before you attempt to scroll the region. You should not move the cursor from the region until you are done with it.
Terminals that have csr defined have a destructive scrolling region. Once a line is scrolled off the screen, the terminal cannot retrieve it. A terminal with a non-destructive scrolling region can restore scrolled lines by reversing the scrolling. Unless the ind, ri, indn, rin, dl, and dl1 all simulate destructive scrolling, do not specify the csr capability if the terminal has non-destructive scrolling regions.
On multipage terminals, scrolling can put a line onto another page and scrolling in the opposite direction brings the line back. Similarly, deleting a line can cause a line from another page to appear on the screen. Multipage terminals should have the da and db capabilities defined so that program that use scrolling can adjust their behavior.
A few terminals can define a window as part of memory. For these types of terminals, all clearing, deletion, insertion, and wrapping commands affect the area in memory where the window is defined.
Generally, terminals handle insert/delete character operations in one of two ways. The most common insert/delete character operations affect only the characters on the current line and shift characters to the right and off the line. Other terminals make a distinctions between typed and untyped blanks on the screen. When inserting a character, the displayed data is shifted and an untyped blank is eliminated. Once all the untyped blanks are eliminated, the displayed data wraps to the next line if you continue to insert characters. When deleting a character, an untyped blank is added to the line to compensate for the deleted character.
Generally, terminals insert/delete characters in one-line mode or multiline mode. The two types of terminals also handle untyped spaces differently. One-line mode is the most common mode. In one-line mode, insert/delete character operations affect only the characters on the current line. Insertions shift characters to the right and off the line.
Multiline mode terminals can affect more than one line. In this mode, the terminal makes a distinction between typed and untyped blanks on the screen. Inserting a character on a multiline mode terminal shifts the displayed data and eliminates untyped blanks. If all the untyped blanks are eliminated and you continue to insert characters, the display wraps to the next line. When deleting a character, multiline terminals add an untyped blank to the line to compensate for the deleted character.
Clearing a screen and then typing text separated by cursor motions helps you determine the type of insert/delete operations your terminal performs. Clear the screen, then proceed as follows: