]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_outopts.3x
ncurses 6.2 - patch 20210417
[ncurses.git] / man / curs_outopts.3x
1 .\"***************************************************************************
2 .\" Copyright 2018,2020 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.33 2020/10/03 22:04:09 tom Exp $
31 .TH curs_outopts 3X ""
32 .na
33 .hy 0
34 .de bP
35 .ie n  .IP \(bu 4
36 .el    .IP \(bu 2
37 ..
38 .SH NAME
39 \fBclearok\fR,
40 \fBidlok\fR,
41 \fBidcok\fR,
42 \fBimmedok\fR,
43 \fBleaveok\fR,
44 \fBsetscrreg\fR,
45 \fBwsetscrreg\fR,
46 \fBscrollok\fR \- \fBcurses\fR output options
47 .ad
48 .hy
49 .SH SYNOPSIS
50 \fB#include <curses.h>\fR
51 .sp
52 \fBint clearok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
53 .br
54 \fBint idlok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
55 .br
56 \fBvoid idcok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
57 .br
58 \fBvoid immedok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
59 .br
60 \fBint leaveok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
61 .br
62 \fBint scrollok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
63 .sp
64 \fBint setscrreg(int \fP\fItop\fP\fB, int \fP\fIbot\fP\fB);\fR
65 .br
66 \fBint wsetscrreg(WINDOW *\fP\fIwin\fP\fB, int \fP\fItop\fP\fB, int \fP\fIbot\fP\fB);\fR
67 .br
68 .SH DESCRIPTION
69 .PP
70 These routines set options that change the style of output within
71 \fBcurses\fR.
72 All options are initially \fBFALSE\fR, unless otherwise stated.
73 It is not necessary to turn these options off before calling \fBendwin\fR(3X).
74 .SS clearok
75 .PP
76 If \fBclearok\fR is called with \fBTRUE\fR as argument, the next
77 call to \fBwrefresh\fR with this window will clear the screen completely and
78 redraw the entire screen from scratch.
79 This is useful when the contents of the
80 screen are uncertain, or in some cases for a more pleasing visual effect.
81 If
82 the \fIwin\fR argument to \fBclearok\fR is the global variable \fBcurscr\fR,
83 the next call to \fBwrefresh\fR with any window causes the screen to be cleared
84 and repainted from scratch.
85 .SS idlok
86 .PP
87 If \fBidlok\fR is called with \fBTRUE\fR as second argument, \fBcurses\fR
88 considers using the hardware insert/delete line feature of terminals so
89 equipped.
90 Calling \fBidlok\fR with \fBFALSE\fR as second argument disables use
91 of line insertion and deletion.
92 This option should be enabled only if the
93 application needs insert/delete line, for example, for a screen editor.
94 It is
95 disabled by default because insert/delete line tends to be visually annoying
96 when used in applications where it is not really needed.
97 If insert/delete line
98 cannot be used, \fBcurses\fR redraws the changed portions of all lines.
99 .SS idcok
100 .PP
101 If \fBidcok\fR is called with \fBFALSE\fR as second argument, \fBcurses\fR
102 no longer considers using the hardware insert/delete character feature of
103 terminals so equipped.
104 Use of character insert/delete is enabled by default.
105 Calling \fBidcok\fR with \fBTRUE\fR as second argument re-enables use
106 of character insertion and deletion.
107 .SS immedok
108 .PP
109 If \fBimmedok\fR is called with \fBTRUE as argument\fR, any change
110 in the window image, such as the ones caused by \fBwaddch, wclrtobot, wscrl\fR,
111 etc., automatically cause a call to \fBwrefresh\fR.
112 However, it may
113 degrade performance considerably, due to repeated calls to \fBwrefresh\fR.
114 It is disabled by default.
115 .SS leaveok
116 .PP
117 Normally, the hardware cursor is left at the location of the window cursor
118 being refreshed.
119 The \fBleaveok\fR option allows the cursor to be left
120 wherever the update happens to leave it.
121 It is useful for applications where
122 the cursor is not used, since it reduces the need for cursor motions.
123 .SS scrollok
124 .PP
125 The \fBscrollok\fR option controls what happens when the cursor of a window is
126 moved off the edge of the window or scrolling region, either as a result of a
127 newline action on the bottom line, or typing the last character of the last
128 line.
129 If disabled, (\fIbf\fR is \fBFALSE\fR), the cursor is left on the bottom
130 line.
131 If enabled, (\fIbf\fR is \fBTRUE\fR), the window is scrolled up one line
132 (Note that to get the physical scrolling effect on the terminal, it is
133 also necessary to call \fBidlok\fR).
134 .SS  setscrreg/wsetscrreg
135 .PP
136 The \fBsetscrreg\fR and \fBwsetscrreg\fR routines allow the application
137 programmer to set a software scrolling region in a window.
138 The \fItop\fR and
139 \fIbot\fR parameters
140 are the line numbers of the top and bottom margin of the scrolling
141 region.
142 (Line 0 is the top line of the window.)  If this option and
143 \fBscrollok\fR are enabled, an attempt to move off the bottom margin line
144 causes all lines in the scrolling region to scroll one line in the direction
145 of the first line.
146 Only the text of the window is scrolled.
147 (Note that this
148 has nothing to do with the use of a physical scrolling region capability in the
149 terminal, like that in the VT100.
150 If \fBidlok\fR is enabled and the terminal
151 has either a scrolling region or insert/delete line capability, they will
152 probably be used by the output routines.)
153 .SH RETURN VALUE
154 The functions \fBsetscrreg\fR and \fBwsetscrreg\fR return \fBOK\fR upon success
155 and \fBERR\fR upon failure.
156 All other routines that return an integer always
157 return \fBOK\fR.
158 .PP
159 X/Open Curses does not define any error conditions.
160 .PP
161 In this implementation,
162 .bP
163 those functions that have a window pointer
164 will return an error if the window pointer is null
165 .bP
166 \fBwsetscrreg\fP
167 returns an error if the scrolling region limits extend outside the window.
168 .RE
169 .PP
170 X/Open does not define any error conditions.
171 This implementation returns an error
172 if the window pointer is null.
173 .SH PORTABILITY
174 These functions are described in the XSI Curses standard, Issue 4.
175 .PP
176 From the outset, ncurses used \fBnl\fP/\fBnonl\fP to control the conversion
177 of newlines to carriage return/line-feed on output as well as input.
178 XSI Curses documents only the use of these functions for input.
179 This difference arose from converting the \fIpcurses\fP source
180 (which used \fBioctl\fP calls with the \fBsgttyb\fP structure)
181 to termios (i.e., the POSIX terminal interface).
182 In the former, both input and output were controlled via a single
183 option \fBCRMOD\fP,
184 while the latter separates these features.
185 Because that conversion interferes with output optimization,
186 \fBnl\fP/\fBnonl\fP were amended after ncurses 6.2
187 to eliminate their effect on output.
188 .PP
189 Some historic curses implementations had, as an undocumented feature, the
190 ability to do the equivalent of \fBclearok(..., 1)\fR by saying
191 \fBtouchwin(stdscr)\fR or \fBclear(stdscr)\fR.
192 This will not work under ncurses.
193 .PP
194 Earlier System V curses implementations specified that with \fBscrollok\fR
195 enabled, any window modification triggering a scroll also forced a physical
196 refresh.
197 XSI Curses does not require this, and \fBncurses\fR avoids doing
198 it to perform better vertical-motion optimization at \fBwrefresh\fR
199 time.
200 .PP
201 The XSI Curses standard does not mention that the cursor should be
202 made invisible as a side-effect of \fBleaveok\fR.
203 SVr4 curses documentation does this, but the code does not.
204 Use \fBcurs_set\fR to make the cursor invisible.
205 .SH NOTES
206 Note that
207 \fBclearok\fR,
208 \fBleaveok\fR,
209 \fBscrollok\fR,
210 \fBidcok\fR, and
211 \fBsetscrreg\fR may be macros.
212 .PP
213 The \fBimmedok\fR routine is useful for windows that are used as terminal
214 emulators.
215 .SH SEE ALSO
216 .na
217 \fBcurses\fR(3X),
218 \fBcurs_addch\fR(3X),
219 \fBcurs_clear\fR(3X),
220 \fBcurs_initscr\fR(3X),
221 \fBcurs_scroll\fR(3X),
222 \fBcurs_refresh\fR(3X),
223 \fBcurs_variables\fR(3X).