📄 terminfo.tail
字号:
This turns out to be essential for the Ann Arbor 4080.).PPA final example is the \s-1LSI ADM\s0-3a, which uses row and columnoffset by a blank character, thus \*(lqcup=\eE=%p1%' '%+%c%p2%' '%+%c\*(rq.After sending `\eE=', this pushes the first parameter, pushes theASCII value for a space (32), adds them (pushing the sum on the stackin 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..PP.SS Cursor Motions.PPIf the terminal has a fast way to home the cursor(to very upper left corner of screen) then this can be given as\fBhome\fR; similarly a fast way of getting to the lower left-hand cornercan be given as \fBll\fR; this may involve going up with \fBcuu1\fRfrom the home position,but a program should never do this itself (unless \fBll\fR does) because itcan make no assumption about the effect of moving up from the home position.Note that the home position is the same as addressing to (0,0):to the top left corner of the screen, not of memory.(Thus, the \eEH sequence on HP terminals cannot be used for.BR home .).PPIf the terminal has row or column absolute cursor addressing,these can be given as single parameter capabilities.B hpa(horizontal position absolute)and.B vpa(vertical position absolute).Sometimes these are shorter than the more general two parametersequence (as with the hp2645) and can be used in preference to.BR cup .If there are parameterized local motions (e.g., move.I nspaces to the right) these can be given as.BR cud ,.BR cub ,.BR cuf ,and.BR cuuwith a single parameter indicating how many spaces to move.These are primarily useful if the terminal does not have.BR cup ,such as the \s-1TEKTRONIX\s+1 4025..PPIf 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 \fBsmcup\fR and \fBrmcup\fR.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 not screenrelative cursor addressing, a one screen-sized window must be fixed intothe terminal for cursor addressing to work properly.This is also used for the \s-1TEKTRONIX\s+1 4025,where.B smcupsets the command character to be the one used by terminfo.If the \fBsmcup\fP sequence will not restore the screen after an\fBrmcup\fP sequence is output (to the state prior to outputting\fBrmcup\fP), specify \fBnrrmc\fP..PP.SS Area Clears.PPIf the terminal can clear from the current position to the end of theline, leaving the cursor where it is, this should be given as \fBel\fR.If the terminal can clear from the beginning of the line to the currentposition inclusive, leavingthe cursor where it is, this should be given as \fBel1\fP.If the terminal can clear from the current position to the end of thedisplay, then this should be given as \fBed\fR.\fBEd\fR is only defined 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.B edis not available.).PP.SS Insert/delete line and vertical motions.PPIf the terminal can open a new blank line before the line where the cursoris, this should be given as \fBil1\fR; this is done only from the firstposition of a line.The cursor must then appear on the newly blank line.If the terminal can delete the line which the cursor is on, then thisshould be given as \fBdl1\fR; this is done only from the first position onthe line to be deleted.Versions of.B il1and.B dl1which take a single parameter and insert or delete that many lines canbe given as.B iland.BR dl ..PPIf the terminal has a settable scrolling region (like the vt100)the command to set this can be described with the.B csrcapability, which takes two parameters:the top and bottom lines of the scrolling region.The cursor position is, alas, undefined after using this command..PPIt is possible to get the effect of insert or delete line using.B csron a properly chosen region; the.B scand.B rc(save and restore cursor) commands may be useful for ensuring thatyour synthesized insert/delete string does not move the cursor.(Note that the \fBncurses\fR(3X) library does this synthesisautomatically, so you need not compose insert/delete strings foran entry with \fBcsr\fR)..PPYet another way to construct insert and delete might be to use a combination ofindex with the memory-lock feature found on some terminals (like the HP-700/90series, which however also has insert/delete)..PPInserting lines at the top or bottom of the screen can also bedone using.B rior.B indon many terminals without a true insert/delete line,and is often faster even on terminals with those features..PPThe boolean \fBnon_dest_scroll_region\fR should be set if each scrollingwindow is effectively a view port on a screen-sized canvas.To test forthis capability, create a scrolling region in the middle of the screen,write something to the bottom line, move the cursor to the top of the region,and do \fBri\fR followed by \fBdl1\fR or \fBind\fR.If the data scrolledoff the bottom of the region by the \fBri\fR re-appears, then scrollingis non-destructive.System V and XSI Curses expect that \fBind\fR, \fBri\fR,\fBindn\fR, and \fBrin\fR will simulate destructive scrolling; theirdocumentation cautions you not to define \fBcsr\fR unless this is true.This \fBcurses\fR implementation is more liberal and will do explicit erasesafter scrolling if \fBndstr\fR is defined..PPIf the terminal has the ability to define a window as part ofmemory, which all commands affect,it should be given as the parameterized string.BR wind .The four parameters are the starting and ending lines in memoryand the starting and ending columns in memory, in that order..PPIf the terminal can retain display memory above, then the\fBda\fR capability should be given; if display memory can be retainedbelow, then \fBdb\fR should be given.These indicatethat deleting a line or scrolling may bring non-blank lines up from belowor that scrolling back with \fBri\fR may bring down non-blank lines..PP.SS Insert/Delete Character.PPThere are two basic kinds of intelligent terminals with respect toinsert/delete character which can be described using.I terminfo.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 determine thekind of terminal you have by clearing the screen and then typingtext separated by cursor motions.Type \*(lqabc\ \ \ \ def\*(rq using localcursor motions (not spaces) between the \*(lqabc\*(rq and the \*(lqdef\*(rq.Then position the cursor before the \*(lqabc\*(rq and 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 \*(lqabc\*(rqshifts over to the \*(lqdef\*(rq which then move together around the end of thecurrent line and onto the next as you insert, you have the second type ofterminal, and should give the capability \fBin\fR, which stands for\*(lqinsert null\*(rq.While these are two logically separate attributes (one line versus multi-lineinsert mode, and special treatment of untyped spaces) we have seen noterminals whose insert mode cannot be described with the single attribute..PPTerminfo can describe both terminals which have an insert mode, and terminalswhich send a simple sequence to open a blank position on the current line.Give as \fBsmir\fR the sequence to get into insert mode.Give as \fBrmir\fR the sequence to leave insert mode.Now give as \fBich1\fR any sequence needed to be sent just before sendingthe character to be inserted.Most terminals with a true insert modewill not give \fBich1\fR; terminals which send a sequence to open a screenposition should give it here..PPIf your terminal has both, insert mode is usually preferable to \fBich1\fR.Technically, you should not give both unless the terminal actually requiresboth to be used in combination.Accordingly, some non-curses applications getconfused if both are present; the symptom is doubled characters in an updateusing insert.This requirement is now rare; most \fBich\fR sequences do notrequire previous smir, and most smir insert modes do not require \fBich1\fRbefore each character.Therefore, the new \fBcurses\fR actually assumes thisis the case and uses either \fBrmir\fR/\fBsmir\fR or \fBich\fR/\fBich1\fR asappropriate (but not both).If you have to write an entry to be used undernew curses for a terminal old enough to need both, include the\fBrmir\fR/\fBsmir\fR sequences in \fBich1\fR..PPIf post insert padding is needed, give this as a number of millisecondsin \fBip\fR (a string option).Any other sequence which may need to besent after an insert of a single character may also be given in \fBip\fR.If your terminal needs both to be placed into an `insert mode' anda special code to precede each inserted character, then both.BR smir / rmirand.B ich1can be given, and both will be used.The.B ichcapability, with one parameter,.IR n ,will repeat the effects of.B ich1.I ntimes..PPIf padding is necessary between characters typed while notin insert mode, give this as a number of milliseconds padding in \fBrmp\fP..PPIt is occasionally necessary to move around while in insert modeto delete characters on the same line (e.g., if there is a tab afterthe insertion position).If your terminal allows motion while ininsert mode you can give the capability \fBmir\fR to speed up insertingin this case.Omitting \fBmir\fR will affect only speed.Some terminals(notably Datamedia's) must not have \fBmir\fR because of the way theirinsert mode works..PPFinally, you can specify.B dch1to delete a single character,.B dchwith one parameter,.IR n ,to delete.I n characters,and delete mode by giving \fBsmdc\fR and \fBrmdc\fRto enter and exit delete mode (any mode the terminal needs to be placedin for.B dch1to work)..PPA command to erase.I ncharacters (equivalent to outputting.I nblanks without moving the cursor)can be given as.B echwith one parameter..PP.SS "Highlighting, Underlining, and Visible Bells".PPIf 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\f2standout mode\fR,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 modeare given as \fBsmso\fR and \fBrmso\fR, respectively.If the code to change into or out of standoutmode leaves one or even two blank spaces on the screen,as the TVI 912 and Teleray 1061 do,then \fBxmc\fR should be given to tell how many spaces are left..PPCodes to begin underlining and end underlining can be given as \fBsmul\fRand \fBrmul\fR respectively.If the terminal has a code to underline the current character and movethe cursor one space to the right,such as the Microterm Mime,this can be given as \fBuc\fR..PPOther capabilities to enter various highlighting modes include.B blink(blinking).B bold(bold or extra bright).B dim(dim or half-bright).B invis(blanking or invisible text).B prot(protected).B rev(reverse video).B sgr0(turn off.I allattribute modes).B smacs(enter alternate character set mode)and.B rmacs(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 modes,this should be given as.B sgr(set attributes),taking 9 parameters.Each parameter is either 0 or nonzero, as the corresponding attribute is on or off.The 9 parameters are, in order:standout, underline, reverse, blink, dim, bold, blank, protect, alternatecharacter set.Not all modes need be supported by.BR sgr ,only those for which corresponding separate attribute commands exist..PPFor example, the DEC vt220 supports most of the modes:.PP.TScenter;l c cl c clw28 lw6 lw2 lw20.\fBtparm parameter attribute escape sequence\fPnone none \\E[0mp1 standout \\E[0;1;7mp2 underline \\E[0;4mp3 reverse \\E[0;7mp4 blink \\E[0;5mp5 dim not availablep6 bold \\E[0;1mp7 invis \\E[0;8mp8 protect not usedp9 altcharset ^O (off) ^N (on).TE.PPWe begin each escape sequence by turning off any existing modes, sincethere is no quick way to determine whether they are active.Standout is set up to be the combination of reverse and bold.The vt220 terminal has a protect mode,though it is not commonly used in sgrbecause it protects characters on the screen from the host's erasures.The altcharset mode also is different in that it is either ^O or ^N,depending on whether it is off or on.If all modes are turned on, the resulting sequence is \\E[0;1;4;5;7;8m^N..PPSome sequences are common to different modes.For example, ;7 is output when either p1 or p3 is true, that is, ifeither standout or reverse modes are turned on..PPWriting out the above sequences, along with their dependencies yields.PP.TScenter;l c cl c clw28 lw6 lw2 lw20.\fBsequence when to output terminfo translation\fP\\E[0 always \\E[0;1 if p1 or p6 %?%p1%p6%|%t;1%;;4 if p2 %?%p2%|%t;4%;;5 if p4 %?%p4%|%t;5%;;7 if p1 or p3 %?%p1%p3%|%t;7%;;8 if p7 %?%p7%|%t;8%;m always m^N or ^O if p9 ^N, else ^O %?%p9%t^N%e^O%;.TE.PPPutting this all together into the sgr sequence gives:.PP.nf sgr=\\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%; %?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\\016%e\\017%;,.fi.PPRemember that if you specify sgr, you must also specify sgr0..PPTerminals with the ``magic cookie'' glitch.RB ( xmc )deposit special ``cookies'' when they receive mode-setting sequences,which affect the display algorithm rather than having extra bits foreach character.Some terminals, such as the HP 2621, automatically leave standoutmode when they move to a new line or the cursor is addressed.Programs using standout mode should exit standout mode beforemoving the cursor or sending a newline,unless the.B msgrcapability, asserting that it is safe to move in standout mode, is present..PPIf the terminal hasa way of flashing the screen to indicate an error quietly (a bell replacement)then this can be given as \fBflash\fR; it must not move the cursor..PPIf the cursor needs to be made more visible than normal when it is
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -