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