Debian Codegraph @

upstream/opensuse-leap-16-1/man3/outopts.3ncurses

raw
1 .\"***************************************************************************
2 .\" Copyright 2018-2024,2025 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.98 2025/04/05 22:40:21 tom Exp $
31 .TH outopts 3NCURSES 2025-04-05 "ncurses 6.5" "Library calls"
32 .ie \n(.g \{\
33 .ds `` \(lq
34 .ds '' \(rq
35 .\}
36 .el \{\
37 .ie t .ds `` ``
38 .el .ds `` ""
39 .ie t .ds '' ''
40 .el .ds '' ""
41 .\}
42 .
43 .de bP
44 .ie n .IP \(bu 4
45 .el .IP \(bu 2
46 ..
47 .SH NAME
48 \fB\%clearok\fP,
49 \fB\%idcok\fP,
50 \fB\%idlok\fP,
51 \fB\%immedok\fP,
52 \fB\%leaveok\fP,
53 \fB\%scrollok\fP,
54 \fB\%setscrreg\fP,
55 \fB\%wsetscrreg\fP \-
56 set \fIcurses\fR output options
57 .SH SYNOPSIS
58 .nf
59 \fB#include <ncursesw/curses.h>
60 .PP
61 \fBint clearok(WINDOW * \fIwin\fP, bool \fIbf\fP);
62 \fBvoid idcok(WINDOW * \fIwin\fP, bool \fIbf\fP);
63 \fBint idlok(WINDOW * \fIwin\fP, bool \fIbf\fP);
64 \fBvoid immedok(WINDOW * \fIwin\fP, bool \fIbf\fP);
65 \fBint leaveok(WINDOW * \fIwin\fP, bool \fIbf\fP);
66 \fBint scrollok(WINDOW * \fIwin\fP, bool \fIbf\fP);
67 .PP
68 \fBint setscrreg(int \fItop\fP, int \fIbot\fP);
69 \fBint wsetscrreg(WINDOW * \fIwin\fP, int \fItop\fP, int \fIbot\fP);
70 .fi
71 .SH DESCRIPTION
72 These functions configure properties of
73 .I curses
74 windows that affect their manner of output.
75 Boolean-valued properties are initially
76 .B FALSE
77 except where noted.
78 \fBendwin\fP(3NCURSES) resets any terminal modes corresponding to these
79 properties;
80 an application need not restore their initial values.
81 .SS clearok
82 Setting
83 .IR win 's
84 .B \%clearok
85 property to
86 .B TRUE
87 causes the next
88 .B \%wrefresh
89 call on it to clear the terminal screen and redraw it entirely.
90 This property is useful to restore the contents of the screen
91 (perhaps because another process has written to the terminal),
92 or in some cases to achieve a more pleasing visual effect.
93 If
94 .I \%win
95 is
96 .B \%curscr
97 (see \fBcurses_variables\fP(3NCURSES)),
98 the next
99 .B \%wrefresh
100 call on
101 .I any
102 window causes the terminal screen to clear and redraw as above.
103 .B \%wrefresh
104 resets this property to
105 .BR FALSE "."
106 .SS idcok
107 (This property defaults
108 .BR TRUE ".)"
109 Setting
110 .IR win 's
111 .B \%idcok
112 property to
113 .B FALSE
114 prevents
115 .I curses
116 from using the insert/delete character capabilities of terminal types
117 possessing them according to the
118 .I \%term\%info
119 database.
120 .\" TODO: What's the historical rationale for the `idcok()` feature?
121 .\" TED: Solaris SVr4 source uses this to bypass some logic which may not work
122 .\" with terminals that use "magic cookies" (cells where the video attribute
123 .\" changes and no actual character is stored).
124 .SS idlok
125 Setting
126 .IR win 's
127 .B \%idlok
128 property to
129 .B TRUE
130 causes
131 .I curses
132 to consider
133 using the insert/delete line capabilities of terminal types
134 possessing them according to the
135 .I \%term\%info
136 database.
137 Enable this option
138 if the application explicitly requires these operations,
139 as a full-screen text editor might;
140 otherwise the results may be visually annoying to the user.
141 .\" TODO: Substantiate that claim.
142 .SS immedok
143 If
144 .B \%immedok
145 is called with
146 .B TRUE
147 as second argument,
148 changes to the window image,
149 such as those caused by
150 .BR \%waddch ","
151 .BR \%wclrtobot ","
152 or
153 .BR \%wscrl ","
154 automatically cause a call to
155 .BR wrefresh "."
156 However,
157 doing so may degrade performance considerably
158 when many such calls occur.
159 Calling
160 .B \%immedok
161 with
162 .B FALSE
163 as second argument
164 restores the default behavior,
165 deferring screen updates until a refresh is needed
166 or explicitly directed by the application.
167 .SS leaveok
168 Normally,
169 .I curses
170 leaves the hardware cursor at the library's cursor location
171 of the window being refreshed.
172 The
173 .B \%leaveok
174 option allows the cursor to be left
175 wherever the update happens to leave it.
176 It is useful for applications that do not employ a visible cursor,
177 since it reduces the need for cursor motions.
178 .SS scrollok
179 The
180 .B \%scrollok
181 option controls what happens when a window's cursor
182 moves off the edge of the window or scrolling region,
183 either as a result of a newline occurring on the bottom line,
184 or writing to the last character of the last line.
185 If disabled
186 .RI ( bf
187 is
188 .BR FALSE "),"
189 .I curses
190 leaves the cursor on the bottom line of the window.
191 If enabled
192 .RI ( bf
193 is
194 .BR TRUE "),"
195 .I curses
196 scrolls the window up one line.
197 (To get the physical scrolling effect on the terminal,
198 the application must also enable
199 .BR idlok ")."
200 .SS "setscrreg, wsetscrreg"
201 The
202 .B \%wsetscrreg
203 and
204 .B \%setscrreg
205 functions allow the application
206 to set a software scrolling region in the specified window or
207 .BR \%stdscr ","
208 respectively.
209 The
210 .I top
211 and
212 .I bot
213 parameters
214 are the line numbers of the top and bottom margin of the scrolling
215 region.
216 (Line 0 is the top line of the window.)
217 If this option and
218 .B scrollok
219 are enabled,
220 an attempt to move off the bottom margin line
221 causes all lines in the scrolling region
222 to scroll one line in the direction of the first line.
223 Only the text of the window is scrolled.
224 (This process has nothing to do
225 with the scrolling region capability of the terminal,
226 as found in the DEC VT100.)
227 If
228 .B \%idlok
229 is enabled and the terminal
230 has either a scrolling region or insert/delete line capability,
231 they will probably be used by the output routines.)
232 .SH RETURN VALUE
233 The functions
234 .B \%setscrreg
235 and
236 .B \%wsetscrreg
237 return
238 .B OK
239 upon success
240 and
241 .B ERR
242 upon failure.
243 All other routines that return an integer always
244 return
245 .BR OK "."
246 .PP
247 In
248 .IR \%ncurses ","
249 these functions fail if
250 .bP
251 the
252 .I curses
253 screen has not been initialized,
254 .bP
255 (for functions taking a
256 .I \%WINDOW
257 pointer argument)
258 .I win
259 is a null pointer,
260 or
261 .bP
262 (for
263 .B \%setscrreg
264 and
265 .BR \%wsetscrreg ")"
266 the function is passed arguments describing a scrolling region
267 with limits that extend outside the window boundaries.
268 .SH NOTES
269 .BR \%clearok ","
270 .BR \%leaveok ","
271 .BR \%scrollok ","
272 .BR \%idcok ","
273 and
274 .B \%setscrreg
275 may be implemented as macros.
276 .PP
277 Unlike the other functions described by this page,
278 .B \%setscrreg
279 does not accept a
280 .RI pointer-to- WINDOW
281 parameter,
282 but operates on
283 .BR stdscr "."
284 Use
285 .B \%wsetscrreg
286 to configure the scrolling region of a selected window.
287 .PP
288 The
289 .B \%immedok
290 routine is useful for windows that are used as terminal
291 emulators.
292 .SH PORTABILITY
293 X/Open Curses Issue\ 4 describes these functions.
294 It specifies no error conditions for them.
295 .PP
296 Some historic
297 .I curses
298 implementations,
299 as an undocumented feature,
300 did the equivalent of
301 .RB \*(`` \%clearok( .\|.\|. ", 1)" \*(''
302 when
303 .B \%touchwin(stdstr)
304 or
305 .B \%clear(stdstr)
306 were used.
307 This trick does not work with
308 .IR \%ncurses .
309 .PP
310 Early System\ V
311 .I curses
312 implementations specified that with
313 .I \%scrollok
314 enabled,
315 any window modification triggering a scroll
316 also forced a physical refresh.
317 X/Open Curses does not require this,
318 and
319 .I \%ncurses
320 avoids doing so to better optimize vertical motions upon a
321 .IR \%wrefresh "."
322 .PP
323 X/Open Curses does not mention that the cursor should be
324 made invisible as a side-effect of
325 .IR \%leaveok "."
326 SVr4
327 .I curses
328 documentation notes this behavior,
329 but the code neglects to implement it.
330 Use \fB\%curs_set\fP(3NCURSES) to make the cursor invisible.
331 .SH HISTORY
332 4BSD (1980)
333 introduced
334 .IR \%clearok ","
335 .IR \%leaveok ","
336 and
337 .IR \%scrollok "."
338 .PP
339 SVr2 (1984)
340 supplied
341 .IR \%idlok ","
342 .IR \%setscrreg ","
343 and
344 .IR \%wsetscrreg "."
345 .PP
346 SVr3.1 (1987)
347 implemented
348 .I \%idcok
349 and
350 .IR \%immedok "."
351 .PP
352 .I \%ncurses
353 formerly treated
354 .I nl
355 and
356 .I nonl
357 as both input
358 .I and
359 output options,
360 but no longer;
361 see \fB\%inopts\fP(3NCURSES).
362 .SH SEE ALSO
363 \fB\%ncurses\fP(3NCURSES),
364 \fB\%addch\fP(3NCURSES),
365 \fB\%clear\fP(3NCURSES),
366 \fB\%initscr\fP(3NCURSES),
367 \fB\%refresh\fP(3NCURSES),
368 \fB\%scroll\fP(3NCURSES),
369 \fB\%curses_variables\fP(3NCURSES)