Debian Codegraph @

doc/html/man/curs_pad.3x.html

raw
1 <!--
2 ****************************************************************************
3 * Copyright 2018-2025,2026 Thomas E. Dickey *
4 * Copyright 1998-2015,2017 Free Software Foundation, Inc. *
5 * *
6 * Permission is hereby granted, free of charge, to any person obtaining a *
7 * copy of this software and associated documentation files (the *
8 * "Software"), to deal in the Software without restriction, including *
9 * without limitation the rights to use, copy, modify, merge, publish, *
10 * distribute, distribute with modifications, sublicense, and/or sell *
11 * copies of the Software, and to permit persons to whom the Software is *
12 * furnished to do so, subject to the following conditions: *
13 * *
14 * The above copyright notice and this permission notice shall be included *
15 * in all copies or substantial portions of the Software. *
16 * *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
20 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
23 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * *
25 * Except as contained in this notice, the name(s) of the above copyright *
26 * holders shall not be used in advertising or otherwise to promote the *
27 * sale, use or other dealings in this Software without prior written *
28 * authorization. *
29 ****************************************************************************
30 * @Id: curs_pad.3x,v 1.82 2026/04/18 22:53:21 tom Exp @
31 -->
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
33 <HTML>
34 <HEAD>
35 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
36 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>curs_pad 3x 2026-04-18 ncurses 6.6 Library calls</TITLE>
38 <link rel="author" href="mailto:[email protected]">
39
40 </HEAD>
41 <BODY>
42 <H1 class="no-header">curs_pad 3x 2026-04-18 ncurses 6.6 Library calls</H1>
43 <PRE>
44 <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG> Library calls <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG>
45
46
47 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
48 <STRONG>newpad</STRONG>, <STRONG>subpad</STRONG>, <STRONG>prefresh</STRONG>, <STRONG>pnoutrefresh</STRONG>, <STRONG>pechochar</STRONG>, <STRONG>pecho_wchar</STRONG> - create
49 and display <EM>curses</EM> pads
50
51
52 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
53 <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
54
55 <STRONG>WINDOW</STRONG> <STRONG>*newpad(int</STRONG> <EM>nlines</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>ncols</EM><STRONG>);</STRONG>
56 <STRONG>WINDOW</STRONG> <STRONG>*subpad(WINDOW</STRONG> <STRONG>*</STRONG><EM>parent</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>nlines</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>ncols</EM><STRONG>,</STRONG>
57 <STRONG>int</STRONG> <EM>begin</EM><STRONG>_</STRONG><EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>begin</EM><STRONG>_</STRONG><EM>x</EM><STRONG>);</STRONG>
58
59 <STRONG>int</STRONG> <STRONG>prefresh(WINDOW</STRONG> <STRONG>*</STRONG><EM>pad</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>pminrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>pmincol</EM><STRONG>,</STRONG>
60 <STRONG>int</STRONG> <EM>sminrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smincol</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smaxrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smaxcol</EM><STRONG>);</STRONG>
61 <STRONG>int</STRONG> <STRONG>pnoutrefresh(WINDOW</STRONG> <STRONG>*</STRONG><EM>pad</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>pminrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>pmincol</EM><STRONG>,</STRONG>
62 <STRONG>int</STRONG> <EM>sminrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smincol</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smaxrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smaxcol</EM><STRONG>);</STRONG>
63
64 <STRONG>int</STRONG> <STRONG>pechochar(WINDOW</STRONG> <STRONG>*</STRONG><EM>pad</EM><STRONG>,</STRONG> <STRONG>chtype</STRONG> <EM>ch</EM><STRONG>);</STRONG>
65 <STRONG>int</STRONG> <STRONG>pecho_wchar(WINDOW</STRONG> <STRONG>*</STRONG><EM>pad</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>cchar_t</STRONG> <STRONG>*</STRONG><EM>wch</EM><STRONG>);</STRONG>
66
67
68 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
69 A <EM>curses</EM> <EM>pad</EM> is like a window, except that it is not restricted by the
70 screen size, and is not necessarily associated with a particular part
71 of the screen. Pads can be used when a large window is needed, only
72 part of which is to be visible on the screen. Pads are not
73 automatically refreshed by scrolling or input-echoing operations.
74
75 Pads cannot be refreshed with <STRONG><A HREF="curs_refresh.3x.html">wrefresh(3x)</A></STRONG>; use <STRONG>prefresh</STRONG> or
76 <STRONG>pnoutrefresh</STRONG> instead.
77
78
79 </PRE><H3><a name="h3-newpad">newpad</a></H3><PRE>
80 <STRONG>newpad</STRONG> creates and returns a pointer to a new pad data structure with
81 the given number of lines, <EM>nlines</EM>, and columns, <EM>ncols</EM>.
82
83
84 </PRE><H3><a name="h3-subpad">subpad</a></H3><PRE>
85 <STRONG>subpad</STRONG> creates and returns a pointer to a subwindow within a pad with
86 the given number of lines, <EM>nlines</EM>, and columns, <EM>ncols</EM>. Unlike
87 <STRONG><A HREF="subwin.3x.html">subwin(3x)</A></STRONG>, which uses screen coordinates, the new pad is placed at
88 position (<EM>begin</EM><STRONG>_</STRONG><EM>y</EM>, <EM>begin</EM><STRONG>_</STRONG><EM>x</EM>) relative to its parent. Thus, changes made
89 to one pad can affect both. When operating on a subpad, it is often
90 necessary to call <STRONG><A HREF="curs_touch.3x.html">touchwin(3x)</A></STRONG> or <STRONG><A HREF="curs_touch.3x.html">touchline(3x)</A></STRONG> on <EM>parent</EM> before
91 calling <STRONG>prefresh</STRONG>.
92
93
94 </PRE><H3><a name="h3-prefresh_pnoutrefresh">prefresh, pnoutrefresh</a></H3><PRE>
95 <STRONG>prefresh</STRONG> and <STRONG>pnoutrefresh</STRONG> are analogous to <STRONG><A HREF="curs_refresh.3x.html">wrefresh(3x)</A></STRONG> and
96 <STRONG><A HREF="curs_refresh.3x.html">wnoutrefresh(3x)</A></STRONG> except that they operate on pads rather than windows.
97 They require additional parameters are needed to indicate what portions
98 of the pad and screen are involved.
99
100 <STRONG>o</STRONG> <EM>pminrow</EM> and <EM>pmincol</EM> specify the upper left-hand corner of a
101 rectangular view of the pad.
102
103 <STRONG>o</STRONG> <EM>sminrow</EM>, <EM>smincol</EM>, <EM>smaxrow</EM>, and <EM>smaxcol</EM> specify the vertices of the
104 rectangle to be displayed on the screen.
105
106 The lower right-hand corner of the rectangle to be displayed in the pad
107 is calculated from the screen coordinates, since the rectangles must be
108 the same size. Both rectangles must be entirely contained within their
109 respective structures. <EM>curses</EM> treats negative values of any of these
110 parameters as zero.
111
112
113 </PRE><H3><a name="h3-pechochar">pechochar</a></H3><PRE>
114 <STRONG>pechochar</STRONG> is functionally equivalent to calling <STRONG><A HREF="curs_addch.3x.html">waddch(3x)</A></STRONG> followed by
115 <STRONG>prefresh</STRONG>. It suggests to the <EM>curses</EM> optimizer that only a single
116 character is being output; a considerable performance benefit may be
117 thus enjoyed. The location of the character <EM>ch</EM> written to the pad is
118 used to populate the arguments to <STRONG>prefresh</STRONG>.
119
120
121 </PRE><H3><a name="h3-pecho_wchar">pecho_wchar</a></H3><PRE>
122 <STRONG>pecho_wchar</STRONG> is functionally equivalent to calling <STRONG><A HREF="curs_add_wch.3x.html">wadd_wch(3x)</A></STRONG> followed
123 by <STRONG>prefresh</STRONG>. It suggests to the <EM>curses</EM> optimizer that only a single
124 wide character is being output; a considerable performance benefit may
125 be thus enjoyed. The location of the character <EM>wch</EM> written to the pad
126 is used to populate the arguments to <STRONG>prefresh</STRONG>.
127
128
129 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
130 Functions that return an integer return <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> upon
131 successful completion.
132
133 Functions that return pointers return a null pointer on failure.
134
135 In this implementation
136
137 <STRONG>prefresh</STRONG> and <STRONG>pnoutrefresh</STRONG>
138 return <STRONG>ERR</STRONG> if the window pointer is null, or if the window is
139 not really a pad or if the area to refresh extends off-screen
140 or if the minimum coordinates are greater than the maximum.
141
142 <STRONG>pechochar</STRONG>
143 returns <STRONG>ERR</STRONG> if the window is not really a pad, and the
144 associated call to <STRONG>wechochar</STRONG> returns <STRONG>ERR</STRONG>.
145
146 <STRONG>pecho_wchar</STRONG>
147 returns <STRONG>ERR</STRONG> if the window is not really a pad, and the
148 associated call to <STRONG>wecho_wchar</STRONG> returns <STRONG>ERR</STRONG>.
149
150
151 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
152 <STRONG>pechochar</STRONG> may be implemented as a macro.
153
154 <EM>curses</EM> documentation is traditionally averse to motivating the term
155 "pad". The Apollo Aegis workstation operating system (<EM>circa</EM> 1981)
156 supported a graphical pad feature.
157
158 <STRONG>o</STRONG> These graphical pads could be much larger than the computer's
159 display.
160
161 <STRONG>o</STRONG> The read-only output from a command could be scrolled back to
162 inspect and select text from the pad.
163
164 The two uses may be related.
165
166
167 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
168 X/Open Curses Issue 4 describes these functions. It specifies no error
169 conditions for them.
170
171 SVr4 describes a successful return value only as "an integer value
172 other than <EM>ERR</EM>".
173
174 The behavior of <EM>subpad</EM> if the parent window is not a pad is
175 undocumented, and is not checked by the vendor Unix implementations.
176
177 <STRONG>o</STRONG> SVr4 <EM>curses</EM>'s <EM>newpad</EM> sets a flag in the <EM>WINDOW</EM> structure indicating
178 that the window is a pad.
179
180 However, it uses this information only in <EM>waddch</EM> (to decide if it
181 should call <EM>wrefresh</EM>) and <EM>wscrl</EM> (to avoid scrolling a pad); its
182 <EM>wrefresh</EM> does not check it to ensure that a pad is properly
183 updated.
184
185 <STRONG>o</STRONG> Solaris <EM>xcurses</EM> checks whether a window is a pad in its
186 <EM>wnoutrefresh</EM>, returning <EM>ERR</EM> in that case.
187
188 However, it sets the flag on subwindows only if the parent window
189 is a pad. Its <EM>newpad</EM> does not set this information. Consequently,
190 the check never fails.
191
192 It makes no comparable check in <EM>pnoutrefresh</EM> -- though
193 interestingly enough, a comment in the source code states that the
194 lack of a check was an MKS extension.
195
196 <STRONG>o</STRONG> NetBSD 7 <EM>curses</EM> sets a flag in the <EM>WINDOW</EM> structure for <EM>newpad</EM> and
197 <EM>subpad</EM>, aiding itself to distinguish between <EM>wnoutrefresh</EM> and
198 <EM>pnoutrefresh</EM>.
199
200 It does not check for the case where a subwindow is created in a
201 pad using <EM>subwin</EM> or <EM>derwin</EM>.
202
203 Its <EM>dupwin</EM> returns a regular window when duplicating a pad.
204 Likewise, its <EM>getwin</EM> always returns a window, even if the saved
205 data was from a pad.
206
207 <EM>ncurses</EM>:
208
209 <STRONG>o</STRONG> sets a flag in the <EM>WINDOW</EM> structure for <EM>newpad</EM> and <EM>subpad</EM>,
210
211 <STRONG>o</STRONG> allows a <EM>subwin</EM> or <EM>derwin</EM> call to succeed having a pad parent by
212 forcing the subwindow to be a pad,
213
214 <STRONG>o</STRONG> checks in both <EM>wnoutrefresh</EM> and <EM>pnoutrefresh</EM> to ensure that pads
215 and windows are handled distinctly, and
216
217 <STRONG>o</STRONG> ensures that <EM>dupwin</EM> and <EM>getwin</EM> treat pads versus windows
218 consistently.
219
220
221 </PRE><H2><a name="h2-HISTORY">HISTORY</a></H2><PRE>
222 SVr2 (1984) introduced <EM>newpad</EM>, <EM>prefresh</EM>, and <EM>pnoutrefresh</EM>, documenting
223 them in a single line each.
224
225 SVr3 (1987) added <EM>subpad</EM> and <EM>pechochar</EM>, and provided more extensive
226 documentation.
227
228 The System V Interface Definition, Version 4 (1995), specified a
229 function named <EM>pechowchar</EM>. This was a later addition to SVr4.<EM>x</EM>, not
230 appearing in the first SVr4 (1989). It differs from X/Open's later
231 <EM>pecho</EM><STRONG>_</STRONG><EM>wchar</EM> in that its <EM>wstr</EM> parameter was a <EM>chtype</EM> instead of a
232 <EM>wchar</EM><STRONG>_</STRONG><EM>t</EM>, and was not <EM>const</EM>-qualified.
233
234
235 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
236 <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>, <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>, <STRONG><A HREF="curs_touch.3x.html">curs_touch(3x)</A></STRONG>
237
238 ncurses 6.6 2026-04-18 <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG>
239 </PRE>
240 <div class="nav">
241 <ul>
242 <li><a href="#h2-NAME">NAME</a></li>
243 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
244 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
245 <ul>
246 <li><a href="#h3-newpad">newpad</a></li>
247 <li><a href="#h3-subpad">subpad</a></li>
248 <li><a href="#h3-prefresh_pnoutrefresh">prefresh, pnoutrefresh</a></li>
249 <li><a href="#h3-pechochar">pechochar</a></li>
250 <li><a href="#h3-pecho_wchar">pecho_wchar</a></li>
251 </ul>
252 </li>
253 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
254 <li><a href="#h2-NOTES">NOTES</a></li>
255 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
256 <li><a href="#h2-HISTORY">HISTORY</a></li>
257 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
258 </ul>
259 </div>
260 </BODY>
261 </HTML>