blob: df263f2c1a81c9dd43348b2dea6f82b75013da98 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04002.\" Copyright 2018-2023,2024 Thomas E. Dickey *
3.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304.\" *
5.\" Permission is hereby granted, free of charge, to any person obtaining a *
6.\" copy of this software and associated documentation files (the *
7.\" "Software"), to deal in the Software without restriction, including *
8.\" without limitation the rights to use, copy, modify, merge, publish, *
9.\" distribute, distribute with modifications, sublicense, and/or sell *
10.\" copies of the Software, and to permit persons to whom the Software is *
11.\" furnished to do so, subject to the following conditions: *
12.\" *
13.\" The above copyright notice and this permission notice shall be included *
14.\" in all copies or substantial portions of the Software. *
15.\" *
16.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23.\" *
24.\" Except as contained in this notice, the name(s) of the above copyright *
25.\" holders shall not be used in advertising or otherwise to promote the *
26.\" sale, use or other dealings in this Software without prior written *
27.\" authorization. *
28.\"***************************************************************************
29.\"
micky3879b9f5e72025-07-08 18:04:53 -040030.\" $Id: curs_outopts.3x,v 1.64 2024/04/20 21:24:19 tom Exp $
31.TH curs_outopts 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
32.de bP
33.ie n .IP \(bu 4
34.el .IP \(bu 2
35..
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053036.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040037\fB\%clearok\fP,
38\fB\%idlok\fP,
39\fB\%idcok\fP,
40\fB\%immedok\fP,
41\fB\%leaveok\fP,
42\fB\%setscrreg\fP,
43\fB\%wsetscrreg\fP,
44\fB\%scrollok\fP \-
45set \fIcurses\fR output options
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053046.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040047.nf
48\fB#include <curses.h>
49.PP
50\fBint clearok(WINDOW *\fIwin\fP, bool \fIbf\fP);
51\fBint idlok(WINDOW *\fIwin\fP, bool \fIbf\fP);
52\fBvoid idcok(WINDOW *\fIwin\fP, bool \fIbf\fP);
53\fBvoid immedok(WINDOW *\fIwin\fP, bool \fIbf\fP);
54\fBint leaveok(WINDOW *\fIwin\fP, bool \fIbf\fP);
55\fBint scrollok(WINDOW *\fIwin\fP, bool \fIbf\fP);
56.PP
57\fBint setscrreg(int \fItop\fP, int \fIbot\fP);
58\fBint wsetscrreg(WINDOW *\fIwin\fP, int \fItop\fP, int \fIbot\fP);
59.fi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053060.SH DESCRIPTION
61These routines set options that change the style of output within
micky3879b9f5e72025-07-08 18:04:53 -040062\fBcurses\fP.
63All options are initially \fBFALSE\fP, unless otherwise stated.
64It is not necessary to turn these options off before calling \fBendwin\fP(3X).
Steve Kondikae271bc2015-11-15 02:50:53 +010065.SS clearok
micky3879b9f5e72025-07-08 18:04:53 -040066If \fBclearok\fP is called with \fBTRUE\fP as argument, the next
67call to \fBwrefresh\fP with this window will clear the screen completely and
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053068redraw the entire screen from scratch.
69This is useful when the contents of the
70screen are uncertain, or in some cases for a more pleasing visual effect.
71If
micky3879b9f5e72025-07-08 18:04:53 -040072the \fIwin\fP argument to \fBclearok\fP is the global variable \fBcurscr\fP,
73the next call to \fBwrefresh\fP with any window causes the screen to be cleared
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053074and repainted from scratch.
Steve Kondikae271bc2015-11-15 02:50:53 +010075.SS idlok
micky3879b9f5e72025-07-08 18:04:53 -040076If \fBidlok\fP is called with \fBTRUE\fP as second argument, \fBcurses\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053077considers using the hardware insert/delete line feature of terminals so
78equipped.
micky3879b9f5e72025-07-08 18:04:53 -040079Calling \fBidlok\fP with \fBFALSE\fP as second argument disables use
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053080of line insertion and deletion.
81This option should be enabled only if the
82application needs insert/delete line, for example, for a screen editor.
83It is
84disabled by default because insert/delete line tends to be visually annoying
85when used in applications where it is not really needed.
86If insert/delete line
micky3879b9f5e72025-07-08 18:04:53 -040087cannot be used, \fBcurses\fP redraws the changed portions of all lines.
Steve Kondikae271bc2015-11-15 02:50:53 +010088.SS idcok
micky3879b9f5e72025-07-08 18:04:53 -040089If \fBidcok\fP is called with \fBFALSE\fP as second argument, \fBcurses\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053090no longer considers using the hardware insert/delete character feature of
91terminals so equipped.
92Use of character insert/delete is enabled by default.
micky3879b9f5e72025-07-08 18:04:53 -040093Calling \fBidcok\fP with \fBTRUE\fP as second argument re-enables use
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053094of character insertion and deletion.
Steve Kondikae271bc2015-11-15 02:50:53 +010095.SS immedok
micky3879b9f5e72025-07-08 18:04:53 -040096If \fBimmedok\fP is called with \fBTRUE\fP as second argument,
97any change in the window image,
98such as the ones caused by \fBwaddch, wclrtobot, wscrl\fP,
99etc., automatically causes a call to \fBwrefresh\fP.
100However, it may degrade performance considerably,
101due to repeated calls to \fBwrefresh\fP.
102Calling \fBimmedok\fP with \fBFALSE\fP as second argument
103restores the default behavior,
104i.e., deferring screen updates until a refresh is needed.
Steve Kondikae271bc2015-11-15 02:50:53 +0100105.SS leaveok
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530106Normally, the hardware cursor is left at the location of the window cursor
107being refreshed.
micky3879b9f5e72025-07-08 18:04:53 -0400108The \fBleaveok\fP option allows the cursor to be left
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530109wherever the update happens to leave it.
110It is useful for applications where
111the cursor is not used, since it reduces the need for cursor motions.
micky3879b9f5e72025-07-08 18:04:53 -0400112.SS scrollok
113The \fBscrollok\fP option controls what happens when the cursor of a window is
114moved off the edge of the window or scrolling region, either as a result of a
115newline action on the bottom line, or typing the last character of the last
116line.
117If disabled, (\fIbf\fP is \fBFALSE\fP), the cursor is left on the bottom
118line.
119If enabled, (\fIbf\fP is \fBTRUE\fP), the window is scrolled up one line
120(Note that to get the physical scrolling effect on the terminal, it is
121also necessary to call \fBidlok\fP).
122.SS "setscrreg, wsetscrreg"
123The \fBsetscrreg\fP and \fBwsetscrreg\fP routines allow the application
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530124programmer to set a software scrolling region in a window.
micky3879b9f5e72025-07-08 18:04:53 -0400125The \fItop\fP and
126\fIbot\fP parameters
Steve Kondikae271bc2015-11-15 02:50:53 +0100127are the line numbers of the top and bottom margin of the scrolling
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530128region.
129(Line 0 is the top line of the window.) If this option and
micky3879b9f5e72025-07-08 18:04:53 -0400130\fBscrollok\fP are enabled, an attempt to move off the bottom margin line
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530131causes all lines in the scrolling region to scroll one line in the direction
132of the first line.
133Only the text of the window is scrolled.
134(Note that this
135has nothing to do with the use of a physical scrolling region capability in the
136terminal, like that in the VT100.
micky3879b9f5e72025-07-08 18:04:53 -0400137If \fBidlok\fP is enabled and the terminal
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530138has either a scrolling region or insert/delete line capability, they will
139probably be used by the output routines.)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530140.SH RETURN VALUE
micky3879b9f5e72025-07-08 18:04:53 -0400141The functions \fBsetscrreg\fP and \fBwsetscrreg\fP return \fBOK\fP upon success
142and \fBERR\fP upon failure.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530143All other routines that return an integer always
micky3879b9f5e72025-07-08 18:04:53 -0400144return \fBOK\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530145.PP
micky3879b9f5e72025-07-08 18:04:53 -0400146X/Open Curses does not specify any error conditions.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530147.PP
micky3879b9f5e72025-07-08 18:04:53 -0400148In this implementation,
149.bP
150those functions that have a window pointer
151will return an error if the window pointer is null
152.bP
153\fBwsetscrreg\fP
154returns an error if the scrolling region limits extend outside the
155window boundaries.
156.SH NOTES
157Note that
158\fBclearok\fP,
159\fBleaveok\fP,
160\fBscrollok\fP,
161\fBidcok\fP, and
162\fBsetscrreg\fP may be macros.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530163.PP
micky3879b9f5e72025-07-08 18:04:53 -0400164The \fBimmedok\fP routine is useful for windows that are used as terminal
165emulators.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530166.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -0400167These functions are described in X/Open Curses, Issue 4.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530168.PP
169Some historic curses implementations had, as an undocumented feature, the
micky3879b9f5e72025-07-08 18:04:53 -0400170ability to do the equivalent of \fBclearok(..., 1)\fP by saying
171\fBtouchwin(stdscr)\fP or \fBclear(stdscr)\fP.
172This will not work under \fI\%ncurses\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530173.PP
micky3879b9f5e72025-07-08 18:04:53 -0400174Earlier System V curses implementations specified that with \fBscrollok\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530175enabled, any window modification triggering a scroll also forced a physical
176refresh.
micky3879b9f5e72025-07-08 18:04:53 -0400177X/Open Curses does not require this, and \fI\%ncurses\fP avoids doing
178it to perform better vertical-motion optimization at \fBwrefresh\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530179time.
180.PP
micky3879b9f5e72025-07-08 18:04:53 -0400181X/Open Curses does not mention that the cursor should be
182made invisible as a side-effect of \fBleaveok\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530183SVr4 curses documentation does this, but the code does not.
micky3879b9f5e72025-07-08 18:04:53 -0400184Use \fBcurs_set\fP to make the cursor invisible.
185.SH HISTORY
186.I \%ncurses
187formerly treated \fBnl\fP(3X) and \fBnonl\fP(3X) as both input
188.I and
189output options,
190but no longer;
191see \fB\%curs_inopts\fP(3X).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530192.SH SEE ALSO
micky3879b9f5e72025-07-08 18:04:53 -0400193\fB\%curses\fP(3X),
194\fB\%curs_addch\fP(3X),
195\fB\%curs_clear\fP(3X),
196\fB\%curs_initscr\fP(3X),
197\fB\%curs_refresh\fP(3X),
198\fB\%curs_scroll\fP(3X),
199\fB\%curs_variables\fP(3X)