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