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