📄 termcap.5
字号:
(like the VT100),the command to set this can be described with the.Sy \&cscapability,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 lineusing this command \(em the.Sy \&scand.Sy \&rc(save and restore cursor) commands are also useful.Inserting lines at the top or bottom of the screen can also be done using.Sy \&sror.Sy \&sfon many terminals without a true insert/delete line,and is often faster even on terminals with those features..PpIf the terminal has the ability to define a window as part of memorywhich all commands affect, it should be given as the parameterized string.Sy \&wi .The four parameters are the starting and ending lines in memoryand the starting and ending columns in memory, in that order.(This.Xr terminfocapability is described for completeness.It is unlikely that any.Nm termcap Ns \- usingprogram will support it.).PpIf the terminal can retain display memory above the screen, then the.Sy \&dacapability should be given;if display memory can be retainedbelow, then.Sy \&dbshould be given.These indicatethat deleting a line or scrolling may bring non-blank lines up from belowor that scrolling back with.Sy \&srmay bring down non-blank lines..Ss Insert/Delete CharacterThere are two basic kinds of intelligent terminals with respect toinsert/delete character that can be described using.Nm termcap .The most common insert/delete character operations affect only the characterson 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, makea distinction between typed and untyped blanks on the screen, shiftingupon an insert or delete only to an untyped blank on the screen which iseither eliminated or expanded to two untyped blanks.You can determinethe kind of terminal you have by clearing the screen then typingtext separated by cursor motions.Type.Dq Li abc\ \ \ \ defusing localcursor motions (not spaces) between the.Dq abcand the.Dq def .Then position the cursor before the.Dq abcand put the terminal in insertmode.If typing characters causes the rest of the line to shiftrigidly and characters to fall off the end, then your terminal doesnot distinguish between blanks and untyped positions.If the.Dq abcshifts over to the.Dq defwhich then move together around the end of thecurrent line and onto the next as you insert, then you have the second type ofterminal and should give the capability.Sy \&in ,which stands for.Dq insert null .While these are two logically separate attributes(one line.Em \&vs .multi-line insert mode,and special treatment of untyped spaces),we have seen no terminals whose insertmode cannot be described with the single attribute..Pp.Nm Termcapcan describe both terminals that have an insert mode and terminalsthat send a simple sequence to open a blank position on the current line.Give as.Sy \&imthe sequence to get into insert mode.Give as.Sy \&eithe sequence to leave insert mode.Now give as.Sy \&icany sequence that needs to be sent just beforeeach character to be inserted.Most terminals with a true insert modewill not give.Sy \&ic ;terminals that use a sequence to open a screenposition should give it here.(If your terminal has both,insert mode is usually preferable to.Sy \&ic .Do not give both unless the terminal actually requires both to be usedin combination.)If post-insert padding is needed, give this as a number of millisecondsin.Sy \&ip(a string option).Any other sequence that may need to besent after insertion of a single character can also be given in.Sy \&ip .If your terminal needs to be placed into an `insert mode'and needs a special code preceding each inserted character,then both.Sy \&im Ns / Sy \&eiand.Sy \&iccan be given, and both will be used.The.Sy \&ICcapability, with one parameter.Em n ,will repeat the effects of.Sy \&ic.Em ntimes..PpIt is occasionally necessary to move around while in insert modeto delete characters on the same line.Pf ( Em e.g . ,if there is a tab afterthe insertion position).If your terminal allows motion while ininsert mode, you can give the capability.Sy \&mito speed up insertingin this case.Omitting.Sy \&miwill affect only speed.Some terminals(notably Datamedia's) must not have.Sy \&mibecause of the way theirinsert mode works..PpFinally, you can specify.Sy \&dcto delete a single character,.Sy \&DCwith one parameter.Em nto delete.Em ncharacters,and delete mode by giving.Sy \&dmand.Sy \&edto enter and exit delete mode(which is any mode the terminal needs to be placed in for.Sy \&dcto work)..Ss Highlighting, Underlining, and Visible BellsIf 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.Em standout mode ,representing a good high-contrast, easy-on-the-eyes formatfor 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 modeare given as.Sy \&soand.Sy \&se ,respectively.If the code to change into or out of standoutmode leaves one or even two blank spaces or garbage characters on the screen,as the.Tn TVI912 and Teleray 1061 do,then.Sy \&sgshould be given to tell how many characters are left..PpCodes to begin underlining and end underlining can be given as.Sy \&usand.Sy \&ue ,respectively.Underline mode change garbage is specified by.Sy \&ug ,similar to.Sy \&sg .If the terminal has a code to underline the current character and movethe cursor one position to the right,such as the Microterm Mime,this can be given as.Sy \&uc ..PpOther capabilities to enter various highlighting modes include.Sy \&mb(blinking),.Sy \&md(bold or extra bright),.Sy \&mh(dim or half-bright),.Sy \&mk(blanking or invisible text),.Sy \&mp(protected),.Sy \&mr(reverse video),.Sy \&me(turn off.Em allattribute modes),.Sy \&as(enter alternate character set mode), and.Sy \&ae(exit alternate character set mode).Turning on any of these modes singly may or may not turn off other modes..PpIf there is a sequence to set arbitrary combinations of mode,this should be given as.Sy \&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.Sy \&sa ,only those for which corresponding attribute commands exist.(It is unlikely that a.Nm termcap Ns \-usingprogram will support this capability, which is defined for compatibilitywith.Xr terminfo . ).PpTerminals with the.Dq magic cookieglitches.Pf ( Sy \&sgand.Sy \&ug ) ,rather than maintaining extra attribute bits for each character cell,instead deposit special.Dq cookies ,or.Dq garbage characters ,,when they receive mode-setting sequences,which affect the display algorithm..PpSome terminals,such as the Hewlett-Packard 2621,automatically leave standoutmode when they move to a new line or when the cursor is addressed.Programs using standout modeshould exit standout mode on such terminalsbefore moving the cursor or sending a newline.On terminals where this is not a problem,the.Sy \&mscapability should be presentto say that this overhead is unnecessary..PpIf the terminal hasa way of flashing the screen to indicate an error quietly(a bell replacement),this can be given as.Sy \&vb ;it must not move the cursor..PpIf the cursor needs to be made more visible than normalwhen it is not on the bottom line(to change, for example, a non-blinking underline into an easier-to-findblock or blinking underline),give this sequence as.Sy \&vs .If there is a way to make the cursor completely invisible, give that as.Sy \&vi .The capability.Sy \&ve ,which undoes the effects of both of these modes,should also be given..PpIf your terminal correctly displays underlined characters(with no special codes needed)even though it does not overstrike,then you should give the capability.Sy \&ul .If overstrikes are erasable with a blank,this should be indicated by giving.Sy \&eo ..Ss KeypadIf 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 handleterminals 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.Sy \&ksand.Sy \&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.Sy \&kl ,.Sy \&kr ,.Sy \&ku ,.Sy \&kd ,and.Sy \&kh ,respectively.If there are function keys such as f0, f1, ..., f9, the codes they sendcan be given as.Sy \&k0 ,.Sy \&k1 ,...,.Sy \&k9 .If these keys have labels other than the default f0 through f9, the labelscan be given as.Sy \&l0 ,.Sy \&l1 ,...,.Sy \&l9 .The codes transmitted by certain other special keys can be given:.Sy \&kH(home down),.Sy \&kb(backspace),.Sy \&ka(clear all tabs),.Sy \&kt(clear the tab stop in this column),.Sy \&kC(clear screen or erase),.Sy \&kD(delete character),.Sy \&kL(delete line),.Sy \&kM(exit insert mode),.Sy \&kE(clear to end of line),.Sy \&kS(clear to end of screen),.Sy \&kI(insert character or enter insert mode),.Sy \&kA(insert line),.Sy \&kN(next page),.Sy \&kP(previous page),.Sy \&kF(scroll forward/down),.Sy \&kR(scroll backward/up), and.Sy \&kT(set a tab stop in this column).In addition, if the keypad has a 3 by 3 array of keysincluding the four arrow keys, then the other five keys can be given as.Sy \&K1 ,.Sy \&K2 ,.Sy \&K3 ,.Sy \&K4 ,and.Sy \&K5 .These keys are useful when the effects of a 3 by 3 directional pad are needed.The obsolete.Sy \&kocapability formerly used to describe.Dq otherfunction keys has beencompletely supplanted by the above capabilities..PpThe.Sy \&maentry is also used to indicate arrow keys on terminals that havesingle-character arrow keys.It is obsolete but still in use inversion 2 of.Sy \&viwhich must be run on some minicomputers due tomemory limitations.This field is redundant with.Sy \&kl ,.Sy \&kr ,.Sy \&ku ,.Sy \&kd ,and.Sy \&kh .It consists of groups of two characters.In each group, the first character is what an arrow key sends, and thesecond character is the corresponding.Sy \&vicommand.These commands are.Ar hfor.Sy \&kl ,.Ar jfor.Sy \&kd ,.Ar kfor.Sy \&ku ,.Ar lfor.Sy \&kr ,and.Ar Hfor.Sy \&kh .For example, the Mime would have.Dq Li ma=^Hh^Kj^Zk^Xlindicating arrow keys left (^H), down (^K), up (^Z), and right (^X).(There is no home key on the Mime.).Ss Tabs and InitializationIf the terminal needs to be in a special mode when runninga program that uses these capabilities,the codes to enter and exit this mode can be given as.Sy \&tiand.Sy \&te .This arises, for example, from terminals like the Concept with more thanone page of memory.If the terminal has only memory-relative cursor addressing and notscreen-relative cursor addressing,a screen-sized window must be fixed intothe display for cursor addressing to work properly.This is also used for the Tektronix 4025, where.Sy \&tisets the command character to be the one used by.Nm termcap ..PpOther capabilitiesinclude.Sy \&is ,an initialization string for the terminal,and.Sy \&if ,the name of a file containing long initialization strings.These strings are expected to set the terminal into modesconsistent with the rest of the.Nm termcapdescription.They are normally sent to the terminal by the.Xr tsetprogram each time the user logs in.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -