blob: 0ab00645197a8b65d0a48399cfd3fa2475fae38a [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04002.\" Copyright 2018-2023,2024 Thomas E. Dickey *
3.\" Copyright 1998-2010,2016 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304.\" *
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.\"
micky3879b9f5e72025-07-08 18:04:53 -040030.\" $Id: curs_clear.3x,v 1.48 2024/04/20 21:20:07 tom Exp $
31.TH curs_clear 3X 2024-04-20 "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..
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053047.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040048\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 \-
56clear all or part of a \fIcurses\fR window
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053057.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040058.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
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053073.SH DESCRIPTION
micky3879b9f5e72025-07-08 18:04:53 -040074.SS "erase, werase"
75The \fBerase\fP and \fBwerase\fP routines copy blanks to every
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053076position in the window, clearing the screen.
77.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053078Blanks created by erasure have the current background rendition (as set
micky3879b9f5e72025-07-08 18:04:53 -040079by \fBwbkgdset\fP(3X)) merged into them.
80.SS "clear, wclear"
81The \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
83cleared completely on the next call to \fBwrefresh\fP for that window
84and repainted from scratch.
85.SS "clrtobot, wclrtobot"
86The \fBclrtobot\fP and \fBwclrtobot\fP routines erase from the cursor to the
87end of screen.
88That is, they erase all lines below the cursor in the window.
89Also, the current line to the right of the cursor, inclusive, is erased.
90.SS "clrtoeol, wclrtoeol"
91The \fBclrtoeol\fP and \fBwclrtoeol\fP routines erase the current line
92to the right of the cursor, inclusive, to the end of the current line.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053093.SH RETURN VALUE
micky3879b9f5e72025-07-08 18:04:53 -040094All routines return the integer \fBOK\fP on success and \fBERR\fP on failure.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053095.PP
96X/Open defines no error conditions.
97In this implementation,
micky3879b9f5e72025-07-08 18:04:53 -040098.bP
99functions using a window pointer parameter return an error if it is null
100.bP
101\fBwclrtoeol\fP returns an error
102if the cursor position is about to wrap.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530103.SH NOTES
micky3879b9f5e72025-07-08 18:04:53 -0400104Note that \fBerase\fP, \fBwerase\fP, \fBclear\fP, \fBwclear\fP,
105\fBclrtobot\fP, and \fBclrtoeol\fP may be macros.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530106.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -0400107These functions are described in X/Open Curses, Issue 4.
108.PP
109The SVr4.0 manual says that these functions could return
110\*(``or a non-negative integer if \fB\%immedok\fP is set\*('',
111referring to the return-value of \fBwrefresh\fP.
112In that implementation, \fBwrefresh\fP would return a count of
113the number of characters written to the terminal.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530114.PP
115Some historic curses implementations had, as an undocumented feature, the
micky3879b9f5e72025-07-08 18:04:53 -0400116ability to do the equivalent of \fBclearok(..., 1)\fP by saying
117\fBtouchwin(stdscr)\fP or \fBclear(stdscr)\fP.
118This will not work under
119\fI\%ncurses\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530120.PP
121This implementation, and others such as Solaris,
122sets the current position to 0,0 after erasing
micky3879b9f5e72025-07-08 18:04:53 -0400123via \fBwerase\fP and \fBwclear\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530124That fact is not documented in other implementations,
125and may not be true of implementations
126which were not derived from SVr4 source.
127.PP
128Not obvious from the description,
129most implementations clear the screen after \fBwclear\fP
130even for a subwindow or derived window.
131If you do not want to clear the screen during the next \fBwrefresh\fP,
132use \fBwerase\fP instead.
133.SH SEE ALSO
micky3879b9f5e72025-07-08 18:04:53 -0400134\fB\%curses\fP(3X),
135\fB\%curs_outopts\fP(3X),
136\fB\%curs_refresh\fP(3X),
137\fB\%curs_variables\fP(3X)