📄 termcap.5
字号:
TERMCAP(5) Minix Programmer's Manual TERMCAP(5)
Row or column absolute cursor addressing can be given as single parameter
capabilities ch (horizontal position absolute) and cv (vertical position
absolute). Sometimes these are shorter than the more general two-
parameter sequence (as with the Hewlett-Packard 2645) and can be used in
preference to cm. If there are parameterized local motions (e.g., move n
positions to the right) these can be given as DO, LE, RI, and UP with a
single parameter indicating how many positions to move. These are
primarily useful if the terminal does not have cm, such as the Tektronix
4025.
Cursor Motions
If the terminal has a fast way to home the cursor (to the very upper left
corner of the screen), this can be given as ho. Similarly, a fast way of
getting to the lower left-hand corner can be given as ll; this may
involve going up with up from the home position, but a program should
never do this itself (unless ll does), because it can make no assumption
about the effect of moving up from the home position. Note that the home
position is the same as cursor address (0,0): to the top left corner of
the screen, not of memory. (Therefore, the "\EH" sequence on Hewlett-
Packard terminals cannot be used for ho.)
Area Clears
If the terminal can clear from the current position to the end of the
line, leaving the cursor where it is, this should be given as ce. If the
terminal can clear from the current position to the end of the display,
this should be given as cd. cd must only be invoked from the first
column of a line. (Therefore, it can be simulated by a request to delete
a large number of lines, if a true cd is not available.)
Insert/Delete Line
If the terminal can open a new blank line before the line containing the
cursor, this should be given as al; this must be invoked only from the
first position of a line. The cursor must then appear at the left of the
newly blank line. If the terminal can delete the line that the cursor is
on, this should be given as dl; this must only be used from the first
position on the line to be deleted. Versions of al and dl which take a
single parameter and insert or delete that many lines can be given as AL
and DL. If the terminal has a settable scrolling region (like the
VT100), the command to set this can be described with the cs capability,
which takes two parameters: the top and bottom lines of the scrolling
region. The cursor position is, alas, undefined after using this
command. It is possible to get the effect of insert or delete line using
this command -- the sc and rc (save and restore cursor) commands are also
useful. Inserting lines at the top or bottom of the screen can also be
done using sr or sf on many terminals without a true insert/delete line,
and is often faster even on terminals with those features.
BSD 1 November 1985 10
TERMCAP(5) Minix Programmer's Manual TERMCAP(5)
If the terminal has the ability to define a window as part of memory
which all commands affect, it should be given as the parameterized string
wi. The four parameters are the starting and ending lines in memory and
the starting and ending columns in memory, in that order. (This terminfo
capability is described for completeness. It is unlikely that any
termcap-using program will support it.)
If the terminal can retain display memory above the screen, then the da
capability should be given; if display memory can be retained below, then
db should be given. These indicate that deleting a line or scrolling may
bring non-blank lines up from below or that scrolling back with sr may
bring down non-blank lines.
Insert/Delete Character
There are two basic kinds of intelligent terminals with respect to
insert/delete character that can be described using termcap. The most
common insert/delete character operations affect only the characters on
the current line and shift characters off the end of the line rigidly.
Other terminals, such as the Concept-100 and the Perkin Elmer Owl, make a
distinction between typed and untyped blanks on the screen, shifting upon
an insert or delete only to an untyped blank on the screen which is
either eliminated or expanded to two untyped blanks. You can determine
the kind of terminal you have by clearing the screen then typing text
separated by cursor motions. Type "abc def" using local cursor
motions (not spaces) between the "abc" and the "def". Then position the
cursor before the "abc" and put the terminal in insert mode. If typing
characters causes the rest of the line to shift rigidly and characters to
fall off the end, then your terminal does not distinguish between blanks
and untyped positions. If the "abc" shifts over to the "def" which then
move together around the end of the current line and onto the next as you
insert, then you have the second type of terminal and should give the
capability in, which stands for "insert null". While these are two
logically separate attributes (one line vs. multi-line insert mode, and
special treatment of untyped spaces), we have seen no terminals whose
insert mode cannot be described with the single attribute.
Termcap can describe both terminals that have an insert mode and
terminals that send a simple sequence to open a blank position on the
current line. Give as im the sequence to get into insert mode. Give as
ei the sequence to leave insert mode. Now give as ic any sequence that
needs to be sent just before each character to be inserted. Most
terminals with a true insert mode will not give ic; terminals that use a
sequence to open a screen position should give it here. (If your
terminal has both, insert mode is usually preferable to ic. Do not give
both unless the terminal actually requires both to be used in
combination.) If post-insert padding is needed, give this as a number of
milliseconds in ip (a string option). Any other sequence that may need
to be sent after insertion of a single character can also be given in ip.
If your terminal needs to be placed into an `insert mode' and needs a
BSD 1 November 1985 11
TERMCAP(5) Minix Programmer's Manual TERMCAP(5)
special code preceding each inserted character, then both im/ei and ic
can be given, and both will be used. The IC capability, with one
parameter n, will repeat the effects of ic n times.
It is occasionally necessary to move around while in insert mode to
delete characters on the same line (e.g., if there is a tab after the
insertion position). If your terminal allows motion while in insert
mode, you can give the capability mi to speed up inserting in this case.
Omitting mi will affect only speed. Some terminals (notably Datamedia's)
must not have mi because of the way their insert mode works.
Finally, you can specify dc to delete a single character, DC with one
parameter n to delete n characters, and delete mode by giving dm and ed
to enter and exit delete mode (which is any mode the terminal needs to be
placed in for dc to work).
Highlighting, Underlining, and Visible Bells
If your terminal has one or more kinds of display attributes, these can
be represented in a number of different ways. You should choose one
display form as standout mode, representing a good high-contrast, easy-
on-the-eyes format for highlighting error messages and other attention
getters. (If you have a choice, reverse video plus half-bright is good,
or reverse video alone.) The sequences to enter and exit standout mode
are given as so and se, respectively. If the code to change into or out
of standout mode leaves one or even two blank spaces or garbage
characters on the screen, as the TVI 912 and Teleray 1061 do, then sg
should be given to tell how many characters are left.
Codes to begin underlining and end underlining can be given as us and ue,
respectively. Underline mode change garbage is specified by ug, similar
to sg. If the terminal has a code to underline the current character and
move the cursor one position to the right, such as the Microterm Mime,
this can be given as uc.
Other capabilities to enter various highlighting modes include mb
(blinking), md (bold or extra bright), mh (dim or half-bright), mk
(blanking or invisible text), mp (protected), mr (reverse video), me
(turn off all attribute modes), as (enter alternate character set mode),
and ae (exit alternate character set mode). Turning on any of these
modes singly may or may not turn off other modes.
If there is a sequence to set arbitrary combinations of mode, this should
be given as sa (set attributes), taking 9 parameters. Each parameter is
either 0 or 1, as the corresponding attributes is on or off. The 9
parameters are, in order: standout, underline, reverse, blink, dim, bold,
blank, protect, and alternate character set. Not all modes need be
supported by sa, only those for which corresponding attribute commands
exist. (It is unlikely that a termcap-using program will support this
capability, which is defined for compatibility with terminfo.)
BSD 1 November 1985 12
TERMCAP(5) Minix Programmer's Manual TERMCAP(5)
Terminals with the "magic cookie" glitches (sg and ug), rather than
maintaining extra attribute bits for each character cell, instead deposit
special "cookies", or "garbage characters", when they receive mode-
setting sequences, which affect the display algorithm.
Some terminals, such as the Hewlett-Packard 2621, automatically leave
standout mode when they move to a new line or when the cursor is
addressed. Programs using standout mode should exit standout mode on
such terminals before moving the cursor or sending a newline. On
terminals where this is not a problem, the ms capability should be
present to say that this overhead is unnecessary.
If the terminal has a way of flashing the screen to indicate an error
quietly (a bell replacement), this can be given as vb; it must not move
the cursor.
If the cursor needs to be made more visible than normal when it is not on
the bottom line (to change, for example, a non-blinking underline into an
easier-to-find block or blinking underline), give this sequence as vs.
If there is a way to make the cursor completely invisible, give that as
vi. The capability ve, which undoes the effects of both of these modes,
should also be given.
If your terminal correctly displays underlined characters (with no
special codes needed) even though it does not overstrike, then you should
give the capability ul. If overstrikes are erasable with a blank, this
should be indicated by giving eo.
Keypad
If the terminal has a keypad that transmits codes when the keys are
pressed, this information can be given. Note that it is not possible to
handle terminals where the keypad only works in local mode (this applies,
for example, to the unshifted Hewlett-Packard 2621 keys). If the keypad
can be set to transmit or not transmit, give these codes as ks and ke.
Otherwise the keypad is assumed to always transmit. The codes sent by
the left-arrow, right-arrow, up-arrow, down-arrow, and home keys can be
given as kl, kr, ku, kd, and kh, respectively. If there are function
keys such as f0, f1, ..., f9, the codes they send can be given as k0,
k1,..., k9. If these keys have labels other than the default f0 through
f9, the labels can be given as l0, l1,..., l9. The codes transmitted by
certain other special keys can be given: kH (home down), kb (backspace),
ka (clear all tabs), kt (clear the tab stop in this column), kC (clear
screen or erase), kD (delete character), kL (delete line), kM (exit
insert mode), kE (clear to end of line), kS (clear to end of screen), kI
(insert character or enter insert mode), kA (insert line), kN (next
page), kP (previous page), kF (scroll forward/down), kR (scroll
backward/up), and kT (set a tab stop in this column). In addition, if
the keypad has a 3 by 3 array of keys including the four arrow keys, then
the other five keys can be given as K1, K2, K3, K4, and K5. These keys
BSD 1 November 1985 13
TERMCAP(5) Minix Programmer's Manual TERMCAP(5)
are useful when the effects of a 3 by 3 directional pad are needed. The
obsolete ko capability formerly used to describe "other" function keys
has been completely supplanted by the above capabilities.
The ma entry is also used to indicate arrow keys on terminals that have
single-character arrow keys. It is obsolete but still in use in version
2 of vi which must be run on some minicomputers due to memory
limitations. This field is redundant with kl, kr, ku, kd, and kh. It
consists of groups of two characters. In each group, the first character
is what an arrow key sends, and the second character is the corresponding
vi command. These commands are h for kl, j for kd, k for ku, l for kr,
and H for kh. For example, the Mime would have "ma=^Hh^Kj^Zk^Xl"
indicating arrow keys left (^H), down (^K), up (^Z), and right (^X).
(There is no home key on the Mime.)
Tabs and Initialization
If the terminal needs to be in a special mode when running a program that
uses these capabilities, the codes to enter and exit this mode can be
given as ti and te. This arises, for example, from terminals like the
Concept with more than one page of memory. If the terminal has only
memory-relative cursor addressing and not screen-relative cursor
addressing, a screen-sized window must be fixed into the display for
cursor addressing to work properly. This is also used for the Tektronix
4025, where ti sets the command character to be the one used by termcap.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -