1 /* Public Domain Curses */
5 RCSID("$Id: clear.c,v 1.35 2008/07/13 16:08:18 wmcbrine Exp $")
7 /*man-start**************************************************************
13 int wclear(WINDOW *win);
15 int werase(WINDOW *win);
17 int wclrtobot(WINDOW *win);
19 int wclrtoeol(WINDOW *win);
22 erase() and werase() copy blanks (i.e. the background chtype) to
23 every cell of the window.
25 clear() and wclear() are similar to erase() and werase(), but
26 they also call clearok() to ensure that the window is
27 cleared on the next wrefresh().
29 clrtobot() and wclrtobot() clear the window from the current
30 cursor position to the end of the window.
32 clrtoeol() and wclrtoeol() clear the window from the current
33 cursor position to the end of the current line.
36 All functions return OK on success and ERR on error.
38 Portability X/Open BSD SYS V
48 **man-end****************************************************************/
50 int wclrtoeol(WINDOW
*win
)
55 PDC_LOG(("wclrtoeol() - called: Row: %d Col: %d\n",
56 win
->_cury
, win
->_curx
));
64 /* wrs (4/10/93) account for window background */
68 for (minx
= x
, ptr
= &win
->_y
[y
][x
]; minx
< win
->_maxx
; minx
++, ptr
++)
71 if (x
< win
->_firstch
[y
] || win
->_firstch
[y
] == _NO_CHANGE
)
74 win
->_lastch
[y
] = win
->_maxx
- 1;
82 PDC_LOG(("clrtoeol() - called\n"));
84 return wclrtoeol(stdscr
);
87 int wclrtobot(WINDOW
*win
)
89 PDC_LOG(("wclrtobot() - called\n"));
94 int savey
= win
->_cury
;
95 int savex
= win
->_curx
;
97 /* should this involve scrolling region somehow ? */
99 if (win
->_cury
+ 1 < win
->_maxy
)
103 for (; win
->_maxy
> win
->_cury
; win
->_cury
++)
116 PDC_LOG(("clrtobot() - called\n"));
118 return wclrtobot(stdscr
);
121 int werase(WINDOW
*win
)
123 PDC_LOG(("werase() - called\n"));
125 if (wmove(win
, 0, 0) == ERR
)
128 return wclrtobot(win
);
133 PDC_LOG(("erase() - called\n"));
135 return werase(stdscr
);
138 int wclear(WINDOW
*win
)
140 PDC_LOG(("wclear() - called\n"));
151 PDC_LOG(("clear() - called\n"));
153 return wclear(stdscr
);