]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_outopts.3x
ncurses 6.4 - patch 20240420
[ncurses.git] / man / curs_outopts.3x
1 .\"***************************************************************************
2 .\" Copyright 2018-2023,2024 Thomas E. Dickey                                *
3 .\" Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
4 .\"                                                                          *
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 .\"
30 .\" $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 ..
36 .SH NAME
37 \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 \-
45 set \fIcurses\fR output options
46 .SH SYNOPSIS
47 .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
60 .SH DESCRIPTION
61 These routines set options that change the style of output within
62 \fBcurses\fP.
63 All options are initially \fBFALSE\fP, unless otherwise stated.
64 It is not necessary to turn these options off before calling \fBendwin\fP(3X).
65 .SS clearok
66 If \fBclearok\fP is called with \fBTRUE\fP as argument, the next
67 call to \fBwrefresh\fP with this window will clear the screen completely and
68 redraw the entire screen from scratch.
69 This is useful when the contents of the
70 screen are uncertain, or in some cases for a more pleasing visual effect.
71 If
72 the \fIwin\fP argument to \fBclearok\fP is the global variable \fBcurscr\fP,
73 the next call to \fBwrefresh\fP with any window causes the screen to be cleared
74 and repainted from scratch.
75 .SS idlok
76 If \fBidlok\fP is called with \fBTRUE\fP as second argument, \fBcurses\fP
77 considers using the hardware insert/delete line feature of terminals so
78 equipped.
79 Calling \fBidlok\fP with \fBFALSE\fP as second argument disables use
80 of line insertion and deletion.
81 This option should be enabled only if the
82 application needs insert/delete line, for example, for a screen editor.
83 It is
84 disabled by default because insert/delete line tends to be visually annoying
85 when used in applications where it is not really needed.
86 If insert/delete line
87 cannot be used, \fBcurses\fP redraws the changed portions of all lines.
88 .SS idcok
89 If \fBidcok\fP is called with \fBFALSE\fP as second argument, \fBcurses\fP
90 no longer considers using the hardware insert/delete character feature of
91 terminals so equipped.
92 Use of character insert/delete is enabled by default.
93 Calling \fBidcok\fP with \fBTRUE\fP as second argument re-enables use
94 of character insertion and deletion.
95 .SS immedok
96 If \fBimmedok\fP is called with \fBTRUE\fP as second argument,
97 any change in the window image,
98 such as the ones caused by \fBwaddch, wclrtobot, wscrl\fP,
99 etc., automatically causes a call to \fBwrefresh\fP.
100 However, it may degrade performance considerably,
101 due to repeated calls to \fBwrefresh\fP.
102 Calling \fBimmedok\fP with \fBFALSE\fP as second argument
103 restores the default behavior,
104 i.e., deferring screen updates until a refresh is needed.
105 .SS leaveok
106 Normally, the hardware cursor is left at the location of the window cursor
107 being refreshed.
108 The \fBleaveok\fP option allows the cursor to be left
109 wherever the update happens to leave it.
110 It is useful for applications where
111 the cursor is not used, since it reduces the need for cursor motions.
112 .SS scrollok
113 The \fBscrollok\fP option controls what happens when the cursor of a window is
114 moved off the edge of the window or scrolling region, either as a result of a
115 newline action on the bottom line, or typing the last character of the last
116 line.
117 If disabled, (\fIbf\fP is \fBFALSE\fP), the cursor is left on the bottom
118 line.
119 If 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
121 also necessary to call \fBidlok\fP).
122 .SS  "setscrreg, wsetscrreg"
123 The \fBsetscrreg\fP and \fBwsetscrreg\fP routines allow the application
124 programmer to set a software scrolling region in a window.
125 The \fItop\fP and
126 \fIbot\fP parameters
127 are the line numbers of the top and bottom margin of the scrolling
128 region.
129 (Line 0 is the top line of the window.)  If this option and
130 \fBscrollok\fP are enabled, an attempt to move off the bottom margin line
131 causes all lines in the scrolling region to scroll one line in the direction
132 of the first line.
133 Only the text of the window is scrolled.
134 (Note that this
135 has nothing to do with the use of a physical scrolling region capability in the
136 terminal, like that in the VT100.
137 If \fBidlok\fP is enabled and the terminal
138 has either a scrolling region or insert/delete line capability, they will
139 probably be used by the output routines.)
140 .SH RETURN VALUE
141 The functions \fBsetscrreg\fP and \fBwsetscrreg\fP return \fBOK\fP upon success
142 and \fBERR\fP upon failure.
143 All other routines that return an integer always
144 return \fBOK\fP.
145 .PP
146 X/Open Curses does not specify any error conditions.
147 .PP
148 In this implementation,
149 .bP
150 those functions that have a window pointer
151 will return an error if the window pointer is null
152 .bP
153 \fBwsetscrreg\fP
154 returns an error if the scrolling region limits extend outside the
155 window boundaries.
156 .SH NOTES
157 Note that
158 \fBclearok\fP,
159 \fBleaveok\fP,
160 \fBscrollok\fP,
161 \fBidcok\fP, and
162 \fBsetscrreg\fP may be macros.
163 .PP
164 The \fBimmedok\fP routine is useful for windows that are used as terminal
165 emulators.
166 .SH PORTABILITY
167 These functions are described in X/Open Curses, Issue 4.
168 .PP
169 Some historic curses implementations had, as an undocumented feature, the
170 ability to do the equivalent of \fBclearok(..., 1)\fP by saying
171 \fBtouchwin(stdscr)\fP or \fBclear(stdscr)\fP.
172 This will not work under \fI\%ncurses\fP.
173 .PP
174 Earlier System V curses implementations specified that with \fBscrollok\fP
175 enabled, any window modification triggering a scroll also forced a physical
176 refresh.
177 X/Open Curses does not require this, and \fI\%ncurses\fP avoids doing
178 it to perform better vertical-motion optimization at \fBwrefresh\fP
179 time.
180 .PP
181 X/Open Curses does not mention that the cursor should be
182 made invisible as a side-effect of \fBleaveok\fP.
183 SVr4 curses documentation does this, but the code does not.
184 Use \fBcurs_set\fP to make the cursor invisible.
185 .SH HISTORY
186 .I \%ncurses
187 formerly treated \fBnl\fP(3X) and \fBnonl\fP(3X) as both input
188 .I and
189 output options,
190 but no longer;
191 see \fB\%curs_inopts\fP(3X).
192 .SH SEE ALSO
193 \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)