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