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