1 .\"***************************************************************************
2 .\" Copyright 2018-2022,2023 Thomas E. Dickey *
3 .\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
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: *
13 .\" The above copyright notice and this permission notice shall be included *
14 .\" in all copies or substantial portions of the Software. *
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. *
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 *
28 .\"***************************************************************************
30 .\" $Id: curs_outopts.3x,v 1.44 2023/09/16 23:37:03 tom Exp $
31 .TH curs_outopts 3X 2023-09-16 "ncurses 6.4" "Library calls"
45 set \fIcurses\fR output options
47 \fB#include <curses.h>\fP
49 \fBint clearok(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR
51 \fBint idlok(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR
53 \fBvoid idcok(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR
55 \fBvoid immedok(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR
57 \fBint leaveok(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR
59 \fBint scrollok(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR
61 \fBint setscrreg(int \fItop\fB, int \fIbot\fB);\fR
63 \fBint wsetscrreg(WINDOW *\fIwin\fB, int \fItop\fB, int \fIbot\fB);\fR
65 These routines set options that change the style of output within
67 All options are initially \fBFALSE\fP, unless otherwise stated.
68 It is not necessary to turn these options off before calling \fBendwin\fP(3X).
70 If \fBclearok\fP is called with \fBTRUE\fP as argument, the next
71 call to \fBwrefresh\fP with this window will clear the screen completely and
72 redraw the entire screen from scratch.
73 This is useful when the contents of the
74 screen are uncertain, or in some cases for a more pleasing visual effect.
76 the \fIwin\fP argument to \fBclearok\fP is the global variable \fBcurscr\fP,
77 the next call to \fBwrefresh\fP with any window causes the screen to be cleared
78 and repainted from scratch.
80 If \fBidlok\fP is called with \fBTRUE\fP as second argument, \fBcurses\fP
81 considers using the hardware insert/delete line feature of terminals so
83 Calling \fBidlok\fP with \fBFALSE\fP as second argument disables use
84 of line insertion and deletion.
85 This option should be enabled only if the
86 application needs insert/delete line, for example, for a screen editor.
88 disabled by default because insert/delete line tends to be visually annoying
89 when used in applications where it is not really needed.
91 cannot be used, \fBcurses\fP redraws the changed portions of all lines.
93 If \fBidcok\fP is called with \fBFALSE\fP as second argument, \fBcurses\fP
94 no longer considers using the hardware insert/delete character feature of
95 terminals so equipped.
96 Use of character insert/delete is enabled by default.
97 Calling \fBidcok\fP with \fBTRUE\fP as second argument re-enables use
98 of character insertion and deletion.
100 If \fBimmedok\fP is called with \fBTRUE as argument\fP, any change
101 in the window image, such as the ones caused by \fBwaddch, wclrtobot, wscrl\fP,
102 etc., automatically cause a call to \fBwrefresh\fP.
104 degrade performance considerably, due to repeated calls to \fBwrefresh\fP.
105 It is disabled by default.
107 Normally, the hardware cursor is left at the location of the window cursor
109 The \fBleaveok\fP option allows the cursor to be left
110 wherever the update happens to leave it.
111 It is useful for applications where
112 the cursor is not used, since it reduces the need for cursor motions.
114 The \fBscrollok\fP option controls what happens when the cursor of a window is
115 moved off the edge of the window or scrolling region, either as a result of a
116 newline action on the bottom line, or typing the last character of the last
118 If disabled, (\fIbf\fP is \fBFALSE\fP), the cursor is left on the bottom
120 If enabled, (\fIbf\fP is \fBTRUE\fP), the window is scrolled up one line
121 (Note that to get the physical scrolling effect on the terminal, it is
122 also necessary to call \fBidlok\fP).
123 .SS setscrreg/wsetscrreg
124 The \fBsetscrreg\fP and \fBwsetscrreg\fP routines allow the application
125 programmer to set a software scrolling region in a window.
128 are the line numbers of the top and bottom margin of the scrolling
130 (Line 0 is the top line of the window.) If this option and
131 \fBscrollok\fP are enabled, an attempt to move off the bottom margin line
132 causes all lines in the scrolling region to scroll one line in the direction
134 Only the text of the window is scrolled.
136 has nothing to do with the use of a physical scrolling region capability in the
137 terminal, like that in the VT100.
138 If \fBidlok\fP is enabled and the terminal
139 has either a scrolling region or insert/delete line capability, they will
140 probably be used by the output routines.)
142 The functions \fBsetscrreg\fP and \fBwsetscrreg\fP return \fBOK\fP upon success
143 and \fBERR\fP upon failure.
144 All other routines that return an integer always
147 X/Open Curses does not define any error conditions.
149 In this implementation,
151 those functions that have a window pointer
152 will return an error if the window pointer is null
155 returns an error if the scrolling region limits extend outside the window.
157 X/Open does not define any error conditions.
158 This implementation returns an error
159 if the window pointer is null.
161 These functions are described in the XSI Curses standard, Issue 4.
163 From the outset, ncurses used \fBnl\fP/\fBnonl\fP to control the conversion
164 of newlines to carriage return/line-feed on output as well as input.
165 XSI Curses documents only the use of these functions for input.
166 This difference arose from converting the \fIpcurses\fP source
167 (which used \fBioctl\fP calls with the \fBsgttyb\fP structure)
168 to termios (i.e., the POSIX terminal interface).
169 In the former, both input and output were controlled via a single
171 while the latter separates these features.
172 Because that conversion interferes with output optimization,
173 \fBnl\fP/\fBnonl\fP were amended after ncurses 6.2
174 to eliminate their effect on output.
176 Some historic curses implementations had, as an undocumented feature, the
177 ability to do the equivalent of \fBclearok(..., 1)\fP by saying
178 \fBtouchwin(stdscr)\fP or \fBclear(stdscr)\fP.
179 This will not work under ncurses.
181 Earlier System V curses implementations specified that with \fBscrollok\fP
182 enabled, any window modification triggering a scroll also forced a physical
184 XSI Curses does not require this, and \fBncurses\fP avoids doing
185 it to perform better vertical-motion optimization at \fBwrefresh\fP
188 The XSI Curses standard does not mention that the cursor should be
189 made invisible as a side-effect of \fBleaveok\fP.
190 SVr4 curses documentation does this, but the code does not.
191 Use \fBcurs_set\fP to make the cursor invisible.
198 \fBsetscrreg\fP may be macros.
200 The \fBimmedok\fP routine is useful for windows that are used as terminal
205 \fBcurs_addch\fP(3X),
206 \fBcurs_clear\fP(3X),
207 \fBcurs_initscr\fP(3X),
208 \fBcurs_scroll\fP(3X),
209 \fBcurs_refresh\fP(3X),
210 \fBcurs_variables\fP(3X).