Debian Codegraph @

upstream/debian-unstable/man3/clear.3ncurses

raw
1 .\"***************************************************************************
2 .\" Copyright 2018-2024,2025 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.58 2025/01/19 00:49:39 tom Exp $
31 .TH clear 3NCURSES 2025-01-18 "ncurses 6.6" "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(3NCURSES)) 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(3NCURSES), 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 In this implementation,
97 .bP
98 functions using a window pointer parameter return
99 .B ERR
100 if it is null
101 .bP
102 \fBwclrtoeol\fP returns an error
103 if the cursor position is about to wrap.
104 .SH NOTES
105 .BR \%erase ","
106 .BR \%werase ","
107 .BR \%clear ","
108 .BR \%wclear ","
109 .BR \%clrtobot ","
110 and
111 .B \%clrtoeol
112 may be implemented as macros.
113 .SH PORTABILITY
114 X/Open Curses Issue\ 4 describes these functions.
115 It specifies no error conditions for them.
116 .PP
117 SVr4 documentation
118 .\" SVID 4, vol. 3, p. 485
119 says that these functions return
120 .I OK
121 \*(``or a non-negative integer if
122 .I \%immedok() \" Courier roman in source
123 is set\*('',
124 referring to the return value from
125 .IR \%wrefresh ","
126 which in SVr4 returns a count of characters
127 written to the window if its
128 .I \%immedok
129 property is set;
130 .\" ...though its wrefresh() man page says nothing about immedok()...
131 in
132 .IR \%ncurses ","
133 it does not.
134 .PP
135 Some historic curses implementations had, as an undocumented feature, the
136 ability to do the equivalent of \fBclearok(..., 1)\fP by saying
137 \fBtouchwin(stdscr)\fP or \fBclear(stdscr)\fP.
138 This will not work under
139 \fI\%ncurses\fP.
140 .PP
141 This implementation, and others such as Solaris,
142 sets the current position to 0,0 after erasing
143 via \fBwerase\fP and \fBwclear\fP.
144 That fact is not documented in other implementations,
145 and may not be true of implementations
146 which were not derived from SVr4 source.
147 .PP
148 Not obvious from the description,
149 most implementations clear the screen after \fBwclear\fP
150 even for a subwindow or derived window.
151 If you do not want to clear the screen during the next \fBwrefresh\fP,
152 use \fBwerase\fP instead.
153 .SH SEE ALSO
154 \fB\%ncurses\fP(3NCURSES),
155 \fB\%outopts\fP(3NCURSES),
156 \fB\%refresh\fP(3NCURSES),
157 \fB\%curses_variables\fP(3NCURSES)