blob: f6d425b2dc7a129e4c78b9b58ac1210aa5e38535 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +01002.\" Copyright (c) 1998-2010,2015 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05303.\" *
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.\"
Steve Kondikae271bc2015-11-15 02:50:53 +010029.\" $Id: curs_outopts.3x,v 1.26 2015/07/21 00:23:43 tom Exp $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053030.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,
Steve Kondikae271bc2015-11-15 02:50:53 +010043\fBnonl\fR \- \fBcurses\fR output options
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053044.ad
45.hy
46.SH SYNOPSIS
47\fB#include <curses.h>\fR
48.sp
Steve Kondikae271bc2015-11-15 02:50:53 +010049\fBint clearok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053050.br
Steve Kondikae271bc2015-11-15 02:50:53 +010051\fBint idlok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053052.br
Steve Kondikae271bc2015-11-15 02:50:53 +010053\fBvoid idcok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053054.br
Steve Kondikae271bc2015-11-15 02:50:53 +010055\fBvoid immedok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053056.br
Steve Kondikae271bc2015-11-15 02:50:53 +010057\fBint leaveok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053058.br
Steve Kondikae271bc2015-11-15 02:50:53 +010059\fBint setscrreg(int \fP\fItop\fP\fB, int \fP\fIbot\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053060.br
Steve Kondikae271bc2015-11-15 02:50:53 +010061\fBint wsetscrreg(WINDOW *\fP\fIwin\fP\fB, int \fP\fItop\fP\fB, int \fP\fIbot\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053062.br
Steve Kondikae271bc2015-11-15 02:50:53 +010063\fBint scrollok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053064.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.
Steve Kondikae271bc2015-11-15 02:50:53 +010074.SS clearok
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053075.PP
76If \fBclearok\fR is called with \fBTRUE\fR as argument, the next
77call to \fBwrefresh\fR with this window will clear the screen completely and
78redraw the entire screen from scratch.
79This is useful when the contents of the
80screen are uncertain, or in some cases for a more pleasing visual effect.
81If
82the \fIwin\fR argument to \fBclearok\fR is the global variable \fBcurscr\fR,
83the next call to \fBwrefresh\fR with any window causes the screen to be cleared
84and repainted from scratch.
Steve Kondikae271bc2015-11-15 02:50:53 +010085.SS idlok
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053086.PP
87If \fBidlok\fR is called with \fBTRUE\fR as second argument, \fBcurses\fR
88considers using the hardware insert/delete line feature of terminals so
89equipped.
90Calling \fBidlok\fR with \fBFALSE\fR as second argument disables use
91of line insertion and deletion.
92This option should be enabled only if the
93application needs insert/delete line, for example, for a screen editor.
94It is
95disabled by default because insert/delete line tends to be visually annoying
96when used in applications where it is not really needed.
97If insert/delete line
98cannot be used, \fBcurses\fR redraws the changed portions of all lines.
Steve Kondikae271bc2015-11-15 02:50:53 +010099.SS idcok
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530100.PP
101If \fBidcok\fR is called with \fBFALSE\fR as second argument, \fBcurses\fR
102no longer considers using the hardware insert/delete character feature of
103terminals so equipped.
104Use of character insert/delete is enabled by default.
105Calling \fBidcok\fR with \fBTRUE\fR as second argument re-enables use
106of character insertion and deletion.
Steve Kondikae271bc2015-11-15 02:50:53 +0100107.SS immedok
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530108.PP
109If \fBimmedok\fR is called with \fBTRUE as argument\fR, any change
110in the window image, such as the ones caused by \fBwaddch, wclrtobot, wscrl\fR,
111etc., automatically cause a call to \fBwrefresh\fR.
112However, it may
113degrade performance considerably, due to repeated calls to \fBwrefresh\fR.
114It is disabled by default.
Steve Kondikae271bc2015-11-15 02:50:53 +0100115.SS leaveok
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530116.PP
117Normally, the hardware cursor is left at the location of the window cursor
118being refreshed.
119The \fBleaveok\fR option allows the cursor to be left
120wherever the update happens to leave it.
121It is useful for applications where
122the cursor is not used, since it reduces the need for cursor motions.
Steve Kondikae271bc2015-11-15 02:50:53 +0100123.SS setscrreg
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530124.PP
125The \fBsetscrreg\fR and \fBwsetscrreg\fR routines allow the application
126programmer to set a software scrolling region in a window.
Steve Kondikae271bc2015-11-15 02:50:53 +0100127The \fItop\fR and
128\fIbot\fR parameters
129are the line numbers of the top and bottom margin of the scrolling
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530130region.
131(Line 0 is the top line of the window.) If this option and
132\fBscrollok\fR are enabled, an attempt to move off the bottom margin line
133causes all lines in the scrolling region to scroll one line in the direction
134of the first line.
135Only the text of the window is scrolled.
136(Note that this
137has nothing to do with the use of a physical scrolling region capability in the
138terminal, like that in the VT100.
139If \fBidlok\fR is enabled and the terminal
140has either a scrolling region or insert/delete line capability, they will
141probably be used by the output routines.)
Steve Kondikae271bc2015-11-15 02:50:53 +0100142.SS scrollok
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530143.PP
144The \fBscrollok\fR option controls what happens when the cursor of a window is
145moved off the edge of the window or scrolling region, either as a result of a
146newline action on the bottom line, or typing the last character of the last
147line.
148If disabled, (\fIbf\fR is \fBFALSE\fR), the cursor is left on the bottom
149line.
150If enabled, (\fIbf\fR is \fBTRUE\fR), the window is scrolled up one line
151(Note that to get the physical scrolling effect on the terminal, it is
152also necessary to call \fBidlok\fR).
Steve Kondikae271bc2015-11-15 02:50:53 +0100153.SS nl, nonl
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530154.PP
155The \fBnl\fR and \fBnonl\fR routines control whether the underlying display
156device translates the return key into newline on input, and whether it
157translates newline into return and line-feed on output (in either case, the
158call \fBaddch('\\n')\fR does the equivalent of return and line feed on the
159virtual screen).
160Initially, these translations do occur.
161If you disable them
162using \fBnonl\fR, \fBcurses\fR will be able to make better use of the line-feed
163capability, resulting in faster cursor motion.
164Also, \fBcurses\fR will then be
165able to detect the return key.
166.SH RETURN VALUE
167The functions \fBsetscrreg\fR and \fBwsetscrreg\fR return \fBOK\fR upon success
168and \fBERR\fR upon failure.
169All other routines that return an integer always
170return \fBOK\fR.
171.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100172X/Open Curses does not define any error conditions.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530173.PP
174In this implementation, those functions that have a window pointer
175will return an error if the window pointer is null.
176.RS
177.TP 5
178.B wclrtoeol
179returns an error
180if the cursor position is about to wrap.
181.TP 5
182.B wsetscrreg
183returns an error if the scrolling region limits extend outside the window.
184.RE
185.PP
186X/Open does not define any error conditions.
187This implementation returns an error
188if the window pointer is null.
189.SH PORTABILITY
190These functions are described in the XSI Curses standard, Issue 4.
191.PP
192The XSI Curses standard is ambiguous on the question of whether \fBraw\fR()
193should disable the CRLF translations controlled by \fBnl\fR() and \fBnonl\fR().
194BSD curses did turn off these translations; AT&T curses (at least as late as
195SVr1) did not.
196We choose to do so, on the theory that a programmer requesting
197raw input wants a clean (ideally 8-bit clean) connection that the operating
198system will not alter.
199.PP
200Some historic curses implementations had, as an undocumented feature, the
201ability to do the equivalent of \fBclearok(..., 1)\fR by saying
202\fBtouchwin(stdscr)\fR or \fBclear(stdscr)\fR.
203This will not work under
204ncurses.
205.PP
206Earlier System V curses implementations specified that with \fBscrollok\fR
207enabled, any window modification triggering a scroll also forced a physical
208refresh.
209XSI Curses does not require this, and \fBncurses\fR avoids doing
210it to perform better vertical-motion optimization at \fBwrefresh\fR
211time.
212.PP
213The XSI Curses standard does not mention that the cursor should be
214made invisible as a side-effect of \fBleaveok\fR.
215SVr4 curses documentation does this, but the code does not.
216Use \fBcurs_set\fR to make the cursor invisible.
217.SH NOTES
218Note that \fBclearok\fR, \fBleaveok\fR, \fBscrollok\fR, \fBidcok\fR, \fBnl\fR,
219\fBnonl\fR and \fBsetscrreg\fR may be macros.
220.PP
221The \fBimmedok\fR routine is useful for windows that are used as terminal
222emulators.
223.SH SEE ALSO
Steve Kondikae271bc2015-11-15 02:50:53 +0100224.na
225\fBcurses\fR(3X),
226\fBcurs_addch\fR(3X),
227\fBcurs_clear\fR(3X),
228\fBcurs_initscr\fR(3X),
229\fBcurs_scroll\fR(3X),
230\fBcurs_refresh\fR(3X),
231\fBcurs_variables\fR(3X).