1curs_clear(3X) curs_clear(3X)
2
3
4
6 erase, werase, clear, wclear, clrtobot, wclrtobot, clrtoeol, wclrtoeol
7 - clear all or part of a curses window
8
10 #include <curses.h>
11
12 int erase(void);
13 int werase(WINDOW *win);
14
15 int clear(void);
16 int wclear(WINDOW *win);
17
18 int clrtobot(void);
19 int wclrtobot(WINDOW *win);
20
21 int clrtoeol(void);
22 int wclrtoeol(WINDOW *win);
23
25 The erase and werase routines copy blanks to every position in the win‐
26 dow, clearing the screen.
27
28 The clear and wclear routines are like erase and werase, but they also
29 call clearok, so that the screen is cleared completely on the next call
30 to wrefresh for that window and repainted from scratch.
31
32 The clrtobot and wclrtobot routines erase from the cursor to the end of
33 screen. That is, they erase all lines below the cursor in the window.
34 Also, the current line to the right of the cursor, inclusive, is
35 erased.
36
37 The clrtoeol and wclrtoeol routines erase the current line to the right
38 of the cursor, inclusive, to the end of the current line.
39
40 Blanks created by erasure have the current background rendition (as set
41 by wbkgdset) merged into them.
42
44 All routines return the integer OK on success and ERR on failure.
45
46 X/Open defines no error conditions. In this implementation,
47
48 • functions using a window pointer parameter return an error if it is
49 null
50
51 • wclrtoeol returns an error if the cursor position is about to wrap.
52
54 Note that erase, werase, clear, wclear, clrtobot, and clrtoeol may be
55 macros.
56
58 These functions are described in the XSI Curses standard, Issue 4. The
59 standard specifies that they return ERR on failure, but specifies no
60 error conditions.
61
62 The SVr4.0 manual says that these functions could return "a non-nega‐
63 tive integer if immedok is set", referring to the return-value of wre‐
64 fresh. In that implementation, wrefresh would return a count of the
65 number of characters written to the terminal.
66
67 Some historic curses implementations had, as an undocumented feature,
68 the ability to do the equivalent of clearok(..., 1) by saying touch‐
69 win(stdscr) or clear(stdscr). This will not work under ncurses.
70
71 This implementation, and others such as Solaris, sets the current posi‐
72 tion to 0,0 after erasing via werase and wclear. That fact is not doc‐
73 umented in other implementations, and may not be true of implementa‐
74 tions which were not derived from SVr4 source.
75
76 Not obvious from the description, most implementations clear the screen
77 after wclear even for a subwindow or derived window. If you do not
78 want to clear the screen during the next wrefresh, use werase instead.
79
81 curses(3X), curs_outopts(3X), curs_refresh(3X), curs_variables(3X)
82
83
84
85 curs_clear(3X)