📄 fns.doc
字号:
.\" Copyright (c) 1992, 1993.\" The Regents of the University of California. All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\" must display the following acknowledgement:.\" This product includes software developed by the University of.\" California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\" may be used to endorse or promote products derived from this software.\" without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" @(#)fns.doc 8.1 (Berkeley) 6/4/93.\".Ds.Fn addch "char ch" \(dg.DeAdd the character.Vn chon the windowat the current \*y.If the character is a newline(\'\en\')the line will be cleared to the end,and the current \*y will be changed to thebeginning off the next lineif newline mapping is on,or to the next line at the same x co-ordinateif it is off.A return(\'\er\')will move to the beginning of the line on the window.Tabs(\'\et\')will be expanded into spacesin the normal tabstop positions ofevery eight characters.\*(Es.Ds.Fn addstr "char *str" \(dg.DeAdd the string pointed to by.Vn stron the window at the current \*y.\*(EsIn this case, it will put on as much as it can..Ds.Fn baudrate "" \(dg.DeReturns the output baud rate of the terminal.This is a system dependent constant(defined in.b <sys/tty.h>on BSD systems,which is included by.b <curses.h> )..Ds.Fn box "WINDOW win" "char vert" "char hor".De.PpDraws a box around the window using.Vn vertas the character for drawing the vertical sides, and.Vn horfor drawing the horizontal lines.If scrolling is not allowed,and the window encompasses the lower right-hand corner of the terminal,the corners are left blank to avoid a scroll..Ds.Fn cbreak "" \(dg.DeSet or the terminal to cbreak mode..Ds.Fn clear "" \(dg.DeResets the entire window to blanks.If.Vn winis a screen,this sets the clear flag,which will cause a clear-screen sequence to be senton the next.Fn refreshcall.This also moves the current \*yto (0\*,0)..Ds.Fn clearok "WINDOW *scr" "int boolf" \(dg.DeSets the clear flag for the screen.Vn scr .If.Vn boolfis non-zero,this will force a clear-screen to be printed on the next.Fn refresh ,or stop it from doing so if.Vn boolfis 0.This only works on screens,and,unlike.Fn clear ,does not alter the contents of the screen.If.Vn scris.Vn curscr ,the next.Fn refreshcall will cause a clear-screen,even if the window passed to.Fn refreshis not a screen..Ds.Fn clrtobot "" \(dg.DeWipes the window clear from the current \*y to the bottom.This does not force a clear-screen sequence on the next refreshunder any circumstances.\*(Nm.Ds.Fn clrtoeol "" \(dg.DeWipes the window clear from the current \*y to the end of the line.\*(Nm.Ds.Fn crmode "" \(dg.DeIdentical to .Fn cbreak .The misnamed macro.Fn crmodeand.Fn nocrmodeis retained for backwards compatibilitywith ealier versions of the library..Ds.Fn delch "".DeDelete the character at the current \*y.Each character after it on the line shifts to the left,and the last character becomes blank..Ds.Fn deleteln "".DeDelete the current line.Every line below the current one will move up,and the bottom line will become blank.The current \*y will remain unchanged..Ds.Fn delwin "WINDOW *win".DeDeletes the window from existence.All resources are freed for future use by.b calloc (3).If a window has a.Fn subwinallocated window inside of it,deleting the outer windowthe subwindow is not affected,even though this does invalidate it.Therefore,subwindows should be deleted before theirouter windows are..Ds.Fn echo "" \(dg.DeSets the terminal to echo characters..Ds.Fn endwin "".DeFinish up window routines before exit.This restores the terminal to the state it was before.Fn initscr(or.Fn gettmodeand.Fn setterm )was called.It should always be called before exiting and before the final calls to .Fn delwin .It does not exit.This is especially useful for resetting tty statswhen trapping rubouts via.b signal (2)..Ds.Fn erase "" \(dg.DeErases the window to blanks without setting the clear flag.This is analagous to.Fn clear ,except that it never causes a clear-screen sequence to be generatedon a.Fn refresh .\*(Nm.Ds.Fn erasechar "" \(dg.DeReturns the erase characterfor the terminal,.i i.e. ,the character used by the user to erase a single character from the input..Ds.Fn flushok "WINDOW *win" "int boolf".DeNormally,.Fn refresh.Fn fflush 's.Vn stdoutwhen it is finished..Fn flushokallows you to control this.if.Vn boolfis non-zero(\c.i i.e. ,non-zero)it will do the.Fn fflush ,otherwise it will not..Ds.Fn getch "" \(dg.DeGets a character from the terminal and (if necessary)echos it on the window.\*(EsOtherwise, the character gotten is returned.If.i noechohas been set, then the window is left unaltered.In order to retain control of the terminal,it is necessary to have one of.i noecho ,.i cbreak ,or.i rawmodeset.If you do not set one,whatever routine you call to read characters will set.i cbreakfor you,and then reset to the original mode when finished..Ds.Fn getstr "char *str" \(dg.DeGet a string through the windowand put it in the location pointed to by.Vn str ,which is assumed to be large enough to handle it.It sets tty modes if necessary,and then calls.Fn getch(or.Fn wgetch )to get the characters needed to fill in the stringuntil a newline or EOF is encountered.The newline stripped off the string.\*(Es.Ds.Fn gettmode "".DeGet the tty stats.This is normally called by.Fn initscr ..Ds.Fn getyx "WINDOW *win" "int y" "int x".DePuts the current \*y of.Vn winin the variables.Vn yand.Vn x .Since it is a macro,not a function,you do not pass the addressof.Vn yand.Vn x ..Ds.Fn idlok "WINDOW *win" "int boolf".DeReserved for future use.This will eventually signal to.Fn refreshthat it is all right to use the insert and delete line sequenceswhen updating the window..Ds.Fn inch "" \(dg.DeReturns the character at the current position on the given window.This does not make any changes to the window..Ds.Fn initscr "".DeInitialize the screen routines.This must be called before any of the screen routines are used.It initializes the terminal-type data and such,and without it none of the routines can operate.If standard input is not a tty,it sets the specifications to the terminalwhose name is pointed to by.Vn Def\*_term(initially "dumb").If the boolean.Vn My\*_termis non-zero,.Vn Def\*_termis always used.If the system supports the.b TIOCGWINSZ.i ioctl(2)call,it is used to get the number of lines and columns for the terminal,otherwise it is taken from the.b termcapdescription..Ds.Fn insch "char c".DeInsert.Vn cat the current \*yEach character after it shifts to the right,and the last character disappears.\*(Es.Ds.Fn insertln "".DeInsert a line above the current one.Every line below the current linewill be shifted down,and the bottom line will disappear.The current line will become blank,and the current \*y will remain unchanged..Ds.Fn killchar "" \(dg.DeReturns the line kill characterfor the terminal,.i i.e. ,the character used by the user to erase an entire line from the input..Ds.Fn leaveok "WINDOW *win" "int boolf" \(dg.DeSets the boolean flag for leaving the cursor after the last change.If.Vn boolfis non-zero,the cursor will be left after the last update on the terminal,and the current \*y for.Vn winwill be changed accordingly.If .Vn boolf is 0 the cursor will be moved to the current \*y.This flag(initially 0)retains its value until changed by the user..Ds.Fn move "int y" "int x".DeChange the current \*y of the window to.Vn y\*,x ). (\*(Es.Ds.Fn mvcur "int lasty" "int lastx" "int newy" "int newx".DeMoves the terminal's cursor from.Vn lasty\*,lastx ) (to.Vn newy\*,newx ) (in an approximation of optimal fashion.This routine uses the functions borrowed from.i exversion 2.6.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -