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