2 /***************************************************************************
4 ****************************************************************************
5 * ncurses is copyright (C) 1992-1995 *
7 * zmbenhal@netcom.com *
9 * esr@snark.thyrsus.com *
11 * Permission is hereby granted to reproduce and distribute ncurses *
12 * by any means and for any fee, whether alone or as part of a *
13 * larger distribution, in source or in binary form, PROVIDED *
14 * this notice is included with any such distribution, and is not *
15 * removed from any of its header files. Mention of ncurses in any *
16 * applications linked with it is highly appreciated. *
18 * ncurses comes AS IS with no warranty, implied or expressed. *
20 ***************************************************************************/
26 ** The routine werase().
30 #include <curses.priv.h>
32 MODULE_ID("$Id: lib_erase.c,v 1.7 1997/02/01 23:18:18 tom Exp $")
34 int werase(WINDOW *win)
37 chtype *sp, *end, *start, *maxx = NULL;
40 T((T_CALLED("werase(%p)"), win));
42 for (y = 0; y <= win->_maxy; y++) {
44 start = win->_line[y].text;
45 end = &start[win->_maxx];
48 for (sp = start; sp <= end; sp++) {
50 if (minx == _NOCHANGE)
52 *sp = _nc_background(win);
55 if (minx != _NOCHANGE) {
56 if (win->_line[y].firstchar > minx ||
57 win->_line[y].firstchar == _NOCHANGE)
58 win->_line[y].firstchar = minx;
60 if (win->_line[y].lastchar < maxx - win->_line[y].text)
61 win->_line[y].lastchar = maxx - win->_line[y].text;
64 win->_curx = win->_cury = 0;
65 win->_flags &= ~_WRAPPED;