]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_clear.3x
ncurses 6.2 - patch 20210306
[ncurses.git] / man / curs_clear.3x
1 .\"***************************************************************************
2 .\" Copyright 2018,2020 Thomas E. Dickey                                     *
3 .\" Copyright 1998-2010,2016 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_clear.3x,v 1.20 2020/10/24 09:19:37 tom Exp $
31 .TH curs_clear 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 \fBerase\fR,
40 \fBwerase\fR,
41 \fBclear\fR,
42 \fBwclear\fR,
43 \fBclrtobot\fR,
44 \fBwclrtobot\fR,
45 \fBclrtoeol\fR,
46 \fBwclrtoeol\fR \- clear all or part of a \fBcurses\fR window
47 .ad
48 .hy
49 .SH SYNOPSIS
50 \fB#include <curses.h>\fR
51 .sp
52 \fBint erase(void);\fR
53 .br
54 \fBint werase(WINDOW *\fP\fIwin\fP\fB);\fR
55 .sp
56 \fBint clear(void);\fR
57 .br
58 \fBint wclear(WINDOW *\fP\fIwin\fP\fB);\fR
59 .sp
60 \fBint clrtobot(void);\fR
61 .br
62 \fBint wclrtobot(WINDOW *\fP\fIwin\fP\fB);\fR
63 .sp
64 \fBint clrtoeol(void);\fR
65 .br
66 \fBint wclrtoeol(WINDOW *\fP\fIwin\fP\fB);\fR
67 .br
68 .SH DESCRIPTION
69 The \fBerase\fR and \fBwerase\fR routines copy blanks to every
70 position in the window, clearing the screen.
71 .PP
72 The \fBclear\fR and \fBwclear\fR routines are like \fBerase\fR and
73 \fBwerase\fR, but they also call \fBclearok\fR, so that the screen is
74 cleared completely on the next call to \fBwrefresh\fR for that window
75 and repainted from scratch.
76 .PP
77 The \fBclrtobot\fR and \fBwclrtobot\fR routines erase from the cursor to the
78 end of screen.
79 That is, they erase all lines below the cursor in the window.
80 Also, the current line to the right of the cursor, inclusive, is erased.
81 .PP
82 The \fBclrtoeol\fR and \fBwclrtoeol\fR routines erase the current line
83 to the right of the cursor, inclusive, to the end of the current line.
84 .PP
85 Blanks created by erasure have the current background rendition (as set
86 by \fBwbkgdset\fR) merged into them.
87 .SH RETURN VALUE
88 All routines return the integer \fBOK\fR on success and \fBERR\fP on failure.
89 .PP
90 X/Open defines no error conditions.
91 In this implementation,
92 .bP
93 functions using a window pointer parameter return an error if it is null
94 .bP
95 \fBwclrtoeol\fP returns an error
96 if the cursor position is about to wrap.
97 .SH NOTES
98 Note that \fBerase\fR, \fBwerase\fR, \fBclear\fR, \fBwclear\fR,
99 \fBclrtobot\fR, and \fBclrtoeol\fR may be macros.
100 .SH PORTABILITY
101 These functions are described in the XSI Curses standard, Issue 4.
102 The
103 standard specifies that they return \fBERR\fR on failure, but specifies no
104 error conditions.
105 .PP
106 The SVr4.0 manual says that these functions could
107 return "a non-negative integer if \fBimmedok\fR is set",
108 referring to the return-value of \fBwrefresh\fP.
109 In that implementation, \fBwrefresh\fP would return a count of
110 the number of characters written to the terminal.
111 .PP
112 Some historic curses implementations had, as an undocumented feature, the
113 ability to do the equivalent of \fBclearok(..., 1)\fR by saying
114 \fBtouchwin(stdscr)\fR or \fBclear(stdscr)\fR.
115 This will not work under
116 ncurses.
117 .PP
118 This implementation, and others such as Solaris,
119 sets the current position to 0,0 after erasing
120 via \fBwerase\fP and \fBwclear\fP.
121 That fact is not documented in other implementations,
122 and may not be true of implementations
123 which were not derived from SVr4 source.
124 .PP
125 Not obvious from the description,
126 most implementations clear the screen after \fBwclear\fP
127 even for a subwindow or derived window.
128 If you do not want to clear the screen during the next \fBwrefresh\fP,
129 use \fBwerase\fP instead.
130 .SH SEE ALSO
131 \fBcurses\fR(3X),
132 \fBcurs_outopts\fR(3X),
133 \fBcurs_refresh\fR(3X),
134 \fBcurs_variables\fR(3X)