| 1 |
<!-- |
| 2 |
**************************************************************************** |
| 3 |
* Copyright 2018-2024,2025 Thomas E. Dickey * |
| 4 |
* Copyright 1998-2010,2016 Free Software Foundation, Inc. * |
| 5 |
* * |
| 6 |
* Permission is hereby granted, free of charge, to any person obtaining a * |
| 7 |
* copy of this software and associated documentation files (the * |
| 8 |
* "Software"), to deal in the Software without restriction, including * |
| 9 |
* without limitation the rights to use, copy, modify, merge, publish, * |
| 10 |
* distribute, distribute with modifications, sublicense, and/or sell * |
| 11 |
* copies of the Software, and to permit persons to whom the Software is * |
| 12 |
* furnished to do so, subject to the following conditions: * |
| 13 |
* * |
| 14 |
* The above copyright notice and this permission notice shall be included * |
| 15 |
* in all copies or substantial portions of the Software. * |
| 16 |
* * |
| 17 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
| 18 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
| 19 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
| 20 |
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
| 21 |
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
| 22 |
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
| 23 |
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
| 24 |
* * |
| 25 |
* Except as contained in this notice, the name(s) of the above copyright * |
| 26 |
* holders shall not be used in advertising or otherwise to promote the * |
| 27 |
* sale, use or other dealings in this Software without prior written * |
| 28 |
* authorization. * |
| 29 |
**************************************************************************** |
| 30 |
* @Id: curs_clear.3x,v 1.58 2025/01/19 00:49:39 tom Exp @ |
| 31 |
--> |
| 32 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
| 33 |
<HTML> |
| 34 |
<HEAD> |
| 35 |
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> |
| 36 |
<meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts"> |
| 37 |
<TITLE>curs_clear 3x 2025-01-18 ncurses 6.6 Library calls</TITLE> |
| 38 |
<link rel="author" href="mailto:[email protected]"> |
| 39 |
|
| 40 |
</HEAD> |
| 41 |
<BODY> |
| 42 |
<H1 class="no-header">curs_clear 3x 2025-01-18 ncurses 6.6 Library calls</H1> |
| 43 |
<PRE> |
| 44 |
<STRONG><A HREF="curs_clear.3x.html">curs_clear(3x)</A></STRONG> Library calls <STRONG><A HREF="curs_clear.3x.html">curs_clear(3x)</A></STRONG> |
| 45 |
|
| 46 |
|
| 47 |
</PRE><H2><a name="h2-NAME">NAME</a></H2><PRE> |
| 48 |
<STRONG>erase</STRONG>, <STRONG>werase</STRONG>, <STRONG>clear</STRONG>, <STRONG>wclear</STRONG>, <STRONG>clrtobot</STRONG>, <STRONG>wclrtobot</STRONG>, <STRONG>clrtoeol</STRONG>, <STRONG>wclrtoeol</STRONG> |
| 49 |
- clear all or part of a <EM>curses</EM> window |
| 50 |
|
| 51 |
|
| 52 |
</PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE> |
| 53 |
<STRONG>#include</STRONG> <STRONG><curses.h></STRONG> |
| 54 |
|
| 55 |
<STRONG>int</STRONG> <STRONG>erase(void);</STRONG> |
| 56 |
<STRONG>int</STRONG> <STRONG>werase(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>);</STRONG> |
| 57 |
|
| 58 |
<STRONG>int</STRONG> <STRONG>clear(void);</STRONG> |
| 59 |
<STRONG>int</STRONG> <STRONG>wclear(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>);</STRONG> |
| 60 |
|
| 61 |
<STRONG>int</STRONG> <STRONG>clrtobot(void);</STRONG> |
| 62 |
<STRONG>int</STRONG> <STRONG>wclrtobot(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>);</STRONG> |
| 63 |
|
| 64 |
<STRONG>int</STRONG> <STRONG>clrtoeol(void);</STRONG> |
| 65 |
<STRONG>int</STRONG> <STRONG>wclrtoeol(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>);</STRONG> |
| 66 |
|
| 67 |
|
| 68 |
</PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE> |
| 69 |
|
| 70 |
</PRE><H3><a name="h3-erase_werase">erase, werase</a></H3><PRE> |
| 71 |
The <STRONG>erase</STRONG> and <STRONG>werase</STRONG> routines copy blanks to every position in the |
| 72 |
window, clearing the screen. |
| 73 |
|
| 74 |
Blanks created by erasure have the current background rendition (as set |
| 75 |
by <STRONG><A HREF="curs_bkgd.3x.html">wbkgdset(3x)</A></STRONG>) merged into them. |
| 76 |
|
| 77 |
|
| 78 |
</PRE><H3><a name="h3-clear_wclear">clear, wclear</a></H3><PRE> |
| 79 |
The <STRONG>clear</STRONG> and <STRONG>wclear</STRONG> routines are like <STRONG>erase</STRONG> and <STRONG>werase</STRONG>, but they also |
| 80 |
call <STRONG><A HREF="curs_outopts.3x.html">clearok(3x)</A></STRONG>, so that the screen is cleared completely on the next |
| 81 |
call to <STRONG>wrefresh</STRONG> for that window and repainted from scratch. |
| 82 |
|
| 83 |
|
| 84 |
</PRE><H3><a name="h3-clrtobot_wclrtobot">clrtobot, wclrtobot</a></H3><PRE> |
| 85 |
The <STRONG>clrtobot</STRONG> and <STRONG>wclrtobot</STRONG> routines erase from the cursor to the end of |
| 86 |
screen. That is, they erase all lines below the cursor in the window. |
| 87 |
Also, the current line to the right of the cursor, inclusive, is |
| 88 |
erased. |
| 89 |
|
| 90 |
|
| 91 |
</PRE><H3><a name="h3-clrtoeol_wclrtoeol">clrtoeol, wclrtoeol</a></H3><PRE> |
| 92 |
The <STRONG>clrtoeol</STRONG> and <STRONG>wclrtoeol</STRONG> routines erase the current line to the right |
| 93 |
of the cursor, inclusive, to the end of the current line. |
| 94 |
|
| 95 |
|
| 96 |
</PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE> |
| 97 |
All routines return the integer <STRONG>OK</STRONG> on success and <STRONG>ERR</STRONG> on failure. |
| 98 |
|
| 99 |
In this implementation, |
| 100 |
|
| 101 |
<STRONG>o</STRONG> functions using a window pointer parameter return <STRONG>ERR</STRONG> if it is null |
| 102 |
|
| 103 |
<STRONG>o</STRONG> <STRONG>wclrtoeol</STRONG> returns an error if the cursor position is about to wrap. |
| 104 |
|
| 105 |
|
| 106 |
</PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE> |
| 107 |
<STRONG>erase</STRONG>, <STRONG>werase</STRONG>, <STRONG>clear</STRONG>, <STRONG>wclear</STRONG>, <STRONG>clrtobot</STRONG>, and <STRONG>clrtoeol</STRONG> may be implemented |
| 108 |
as macros. |
| 109 |
|
| 110 |
|
| 111 |
</PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE> |
| 112 |
X/Open Curses Issue 4 describes these functions. It specifies no error |
| 113 |
conditions for them. |
| 114 |
|
| 115 |
SVr4 documentation says that these functions return <EM>OK</EM> "or a non- |
| 116 |
negative integer if <EM>immedok()</EM> is set", referring to the return value |
| 117 |
from <EM>wrefresh</EM>, which in SVr4 returns a count of characters written to |
| 118 |
the window if its <EM>immedok</EM> property is set; in <EM>ncurses</EM>, it does not. |
| 119 |
|
| 120 |
Some historic curses implementations had, as an undocumented feature, |
| 121 |
the ability to do the equivalent of <STRONG>clearok(...,</STRONG> <STRONG>1)</STRONG> by saying |
| 122 |
<STRONG>touchwin(stdscr)</STRONG> or <STRONG>clear(stdscr)</STRONG>. This will not work under <EM>ncurses</EM>. |
| 123 |
|
| 124 |
This implementation, and others such as Solaris, sets the current |
| 125 |
position to 0,0 after erasing via <STRONG>werase</STRONG> and <STRONG>wclear</STRONG>. That fact is not |
| 126 |
documented in other implementations, and may not be true of |
| 127 |
implementations which were not derived from SVr4 source. |
| 128 |
|
| 129 |
Not obvious from the description, most implementations clear the screen |
| 130 |
after <STRONG>wclear</STRONG> even for a subwindow or derived window. If you do not |
| 131 |
want to clear the screen during the next <STRONG>wrefresh</STRONG>, use <STRONG>werase</STRONG> instead. |
| 132 |
|
| 133 |
|
| 134 |
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> |
| 135 |
<STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3x)</A></STRONG>, <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG> |
| 136 |
|
| 137 |
ncurses 6.6 2025-01-18 <STRONG><A HREF="curs_clear.3x.html">curs_clear(3x)</A></STRONG> |
| 138 |
</PRE> |
| 139 |
<div class="nav"> |
| 140 |
<ul> |
| 141 |
<li><a href="#h2-NAME">NAME</a></li> |
| 142 |
<li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li> |
| 143 |
<li><a href="#h2-DESCRIPTION">DESCRIPTION</a> |
| 144 |
<ul> |
| 145 |
<li><a href="#h3-erase_werase">erase, werase</a></li> |
| 146 |
<li><a href="#h3-clear_wclear">clear, wclear</a></li> |
| 147 |
<li><a href="#h3-clrtobot_wclrtobot">clrtobot, wclrtobot</a></li> |
| 148 |
<li><a href="#h3-clrtoeol_wclrtoeol">clrtoeol, wclrtoeol</a></li> |
| 149 |
</ul> |
| 150 |
</li> |
| 151 |
<li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li> |
| 152 |
<li><a href="#h2-NOTES">NOTES</a></li> |
| 153 |
<li><a href="#h2-PORTABILITY">PORTABILITY</a></li> |
| 154 |
<li><a href="#h2-SEE-ALSO">SEE ALSO</a></li> |
| 155 |
</ul> |
| 156 |
</div> |
| 157 |
</BODY> |
| 158 |
</HTML> |