Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | .\"*************************************************************************** |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 2 | .\" Copyright 2018-2023,2024 Thomas E. Dickey * |
| 3 | .\" Copyright 1998-2010,2016 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 | .\" |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 30 | .\" $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 Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 47 | .SH NAME |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 57 | .SH SYNOPSIS |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 73 | .SH DESCRIPTION |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 74 | .SS "erase, werase" |
| 75 | The \fBerase\fP and \fBwerase\fP routines copy blanks to every |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 76 | position in the window, clearing the screen. |
| 77 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 78 | Blanks created by erasure have the current background rendition (as set |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 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. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 93 | .SH RETURN VALUE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 94 | All routines return the integer \fBOK\fP on success and \fBERR\fP on failure. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 95 | .PP |
| 96 | X/Open defines no error conditions. |
| 97 | In this implementation, |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 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. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 103 | .SH NOTES |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 104 | Note that \fBerase\fP, \fBwerase\fP, \fBclear\fP, \fBwclear\fP, |
| 105 | \fBclrtobot\fP, and \fBclrtoeol\fP may be macros. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 106 | .SH PORTABILITY |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 107 | These functions are described in X/Open Curses, 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. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 114 | .PP |
| 115 | Some historic curses implementations had, as an undocumented feature, the |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 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. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 120 | .PP |
| 121 | This implementation, and others such as Solaris, |
| 122 | sets the current position to 0,0 after erasing |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 123 | via \fBwerase\fP and \fBwclear\fP. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 134 | \fB\%curses\fP(3X), |
| 135 | \fB\%curs_outopts\fP(3X), |
| 136 | \fB\%curs_refresh\fP(3X), |
| 137 | \fB\%curs_variables\fP(3X) |