blob: 3fd437a312bbf4ddc70715664e638cc793983c60 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
2.\" Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. *
3.\" *
4.\" Permission is hereby granted, free of charge, to any person obtaining a *
5.\" copy of this software and associated documentation files (the *
6.\" "Software"), to deal in the Software without restriction, including *
7.\" without limitation the rights to use, copy, modify, merge, publish, *
8.\" distribute, distribute with modifications, sublicense, and/or sell *
9.\" copies of the Software, and to permit persons to whom the Software is *
10.\" furnished to do so, subject to the following conditions: *
11.\" *
12.\" The above copyright notice and this permission notice shall be included *
13.\" in all copies or substantial portions of the Software. *
14.\" *
15.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
22.\" *
23.\" Except as contained in this notice, the name(s) of the above copyright *
24.\" holders shall not be used in advertising or otherwise to promote the *
25.\" sale, use or other dealings in this Software without prior written *
26.\" authorization. *
27.\"***************************************************************************
28.\"
29.\" $Id: curs_outopts.3x,v 1.21 2007/06/02 20:40:07 tom Exp $
30.TH curs_outopts 3X ""
31.na
32.hy 0
33.SH NAME
34\fBclearok\fR,
35\fBidlok\fR,
36\fBidcok\fR,
37\fBimmedok\fR,
38\fBleaveok\fR,
39\fBsetscrreg\fR,
40\fBwsetscrreg\fR,
41\fBscrollok\fR,
42\fBnl\fR,
43\fBnonl\fR - \fBcurses\fR output options
44.ad
45.hy
46.SH SYNOPSIS
47\fB#include <curses.h>\fR
48.sp
49\fBint clearok(WINDOW *win, bool bf);\fR
50.br
51\fBint idlok(WINDOW *win, bool bf);\fR
52.br
53\fBvoid idcok(WINDOW *win, bool bf);\fR
54.br
55\fBvoid immedok(WINDOW *win, bool bf);\fR
56.br
57\fBint leaveok(WINDOW *win, bool bf);\fR
58.br
59\fBint setscrreg(int top, int bot);\fR
60.br
61\fBint wsetscrreg(WINDOW *win, int top, int bot);\fR
62.br
63\fBint scrollok(WINDOW *win, bool bf);\fR
64.br
65\fBint nl(void);\fR
66.br
67\fBint nonl(void);\fR
68.br
69.SH DESCRIPTION
70These routines set options that change the style of output within
71\fBcurses\fR.
72All options are initially \fBFALSE\fR, unless otherwise stated.
73It is not necessary to turn these options off before calling \fBendwin\fR.
74.PP
75If \fBclearok\fR is called with \fBTRUE\fR as argument, the next
76call to \fBwrefresh\fR with this window will clear the screen completely and
77redraw the entire screen from scratch.
78This is useful when the contents of the
79screen are uncertain, or in some cases for a more pleasing visual effect.
80If
81the \fIwin\fR argument to \fBclearok\fR is the global variable \fBcurscr\fR,
82the next call to \fBwrefresh\fR with any window causes the screen to be cleared
83and repainted from scratch.
84.PP
85If \fBidlok\fR is called with \fBTRUE\fR as second argument, \fBcurses\fR
86considers using the hardware insert/delete line feature of terminals so
87equipped.
88Calling \fBidlok\fR with \fBFALSE\fR as second argument disables use
89of line insertion and deletion.
90This option should be enabled only if the
91application needs insert/delete line, for example, for a screen editor.
92It is
93disabled by default because insert/delete line tends to be visually annoying
94when used in applications where it is not really needed.
95If insert/delete line
96cannot be used, \fBcurses\fR redraws the changed portions of all lines.
97.PP
98If \fBidcok\fR is called with \fBFALSE\fR as second argument, \fBcurses\fR
99no longer considers using the hardware insert/delete character feature of
100terminals so equipped.
101Use of character insert/delete is enabled by default.
102Calling \fBidcok\fR with \fBTRUE\fR as second argument re-enables use
103of character insertion and deletion.
104.PP
105If \fBimmedok\fR is called with \fBTRUE as argument\fR, any change
106in the window image, such as the ones caused by \fBwaddch, wclrtobot, wscrl\fR,
107etc., automatically cause a call to \fBwrefresh\fR.
108However, it may
109degrade performance considerably, due to repeated calls to \fBwrefresh\fR.
110It is disabled by default.
111.PP
112Normally, the hardware cursor is left at the location of the window cursor
113being refreshed.
114The \fBleaveok\fR option allows the cursor to be left
115wherever the update happens to leave it.
116It is useful for applications where
117the cursor is not used, since it reduces the need for cursor motions.
118.PP
119The \fBsetscrreg\fR and \fBwsetscrreg\fR routines allow the application
120programmer to set a software scrolling region in a window.
121\fItop\fR and
122\fIbot\fR are the line numbers of the top and bottom margin of the scrolling
123region.
124(Line 0 is the top line of the window.) If this option and
125\fBscrollok\fR are enabled, an attempt to move off the bottom margin line
126causes all lines in the scrolling region to scroll one line in the direction
127of the first line.
128Only the text of the window is scrolled.
129(Note that this
130has nothing to do with the use of a physical scrolling region capability in the
131terminal, like that in the VT100.
132If \fBidlok\fR is enabled and the terminal
133has either a scrolling region or insert/delete line capability, they will
134probably be used by the output routines.)
135.PP
136The \fBscrollok\fR option controls what happens when the cursor of a window is
137moved off the edge of the window or scrolling region, either as a result of a
138newline action on the bottom line, or typing the last character of the last
139line.
140If disabled, (\fIbf\fR is \fBFALSE\fR), the cursor is left on the bottom
141line.
142If enabled, (\fIbf\fR is \fBTRUE\fR), the window is scrolled up one line
143(Note that to get the physical scrolling effect on the terminal, it is
144also necessary to call \fBidlok\fR).
145.PP
146The \fBnl\fR and \fBnonl\fR routines control whether the underlying display
147device translates the return key into newline on input, and whether it
148translates newline into return and line-feed on output (in either case, the
149call \fBaddch('\\n')\fR does the equivalent of return and line feed on the
150virtual screen).
151Initially, these translations do occur.
152If you disable them
153using \fBnonl\fR, \fBcurses\fR will be able to make better use of the line-feed
154capability, resulting in faster cursor motion.
155Also, \fBcurses\fR will then be
156able to detect the return key.
157.SH RETURN VALUE
158The functions \fBsetscrreg\fR and \fBwsetscrreg\fR return \fBOK\fR upon success
159and \fBERR\fR upon failure.
160All other routines that return an integer always
161return \fBOK\fR.
162.PP
163X/Open does not define any error conditions.
164.PP
165In this implementation, those functions that have a window pointer
166will return an error if the window pointer is null.
167.RS
168.TP 5
169.B wclrtoeol
170returns an error
171if the cursor position is about to wrap.
172.TP 5
173.B wsetscrreg
174returns an error if the scrolling region limits extend outside the window.
175.RE
176.PP
177X/Open does not define any error conditions.
178This implementation returns an error
179if the window pointer is null.
180.SH PORTABILITY
181These functions are described in the XSI Curses standard, Issue 4.
182.PP
183The XSI Curses standard is ambiguous on the question of whether \fBraw\fR()
184should disable the CRLF translations controlled by \fBnl\fR() and \fBnonl\fR().
185BSD curses did turn off these translations; AT&T curses (at least as late as
186SVr1) did not.
187We choose to do so, on the theory that a programmer requesting
188raw input wants a clean (ideally 8-bit clean) connection that the operating
189system will not alter.
190.PP
191Some historic curses implementations had, as an undocumented feature, the
192ability to do the equivalent of \fBclearok(..., 1)\fR by saying
193\fBtouchwin(stdscr)\fR or \fBclear(stdscr)\fR.
194This will not work under
195ncurses.
196.PP
197Earlier System V curses implementations specified that with \fBscrollok\fR
198enabled, any window modification triggering a scroll also forced a physical
199refresh.
200XSI Curses does not require this, and \fBncurses\fR avoids doing
201it to perform better vertical-motion optimization at \fBwrefresh\fR
202time.
203.PP
204The XSI Curses standard does not mention that the cursor should be
205made invisible as a side-effect of \fBleaveok\fR.
206SVr4 curses documentation does this, but the code does not.
207Use \fBcurs_set\fR to make the cursor invisible.
208.SH NOTES
209Note that \fBclearok\fR, \fBleaveok\fR, \fBscrollok\fR, \fBidcok\fR, \fBnl\fR,
210\fBnonl\fR and \fBsetscrreg\fR may be macros.
211.PP
212The \fBimmedok\fR routine is useful for windows that are used as terminal
213emulators.
214.SH SEE ALSO
215\fBcurses\fR(3X), \fBcurs_addch\fR(3X), \fBcurs_clear\fR(3X),
216\fBcurs_initscr\fR(3X), \fBcurs_scroll\fR(3X), \fBcurs_refresh\fR(3X)
217.\"#
218.\"# The following sets edit modes for GNU EMACS
219.\"# Local Variables:
220.\"# mode:nroff
221.\"# fill-column:79
222.\"# End: