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