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 wclrtoeol().
30 #include <curses.priv.h>
32 MODULE_ID("$Id: lib_clreol.c,v 1.9 1997/02/01 23:22:54 tom Exp $")
34 int wclrtoeol(WINDOW *win)
36 chtype *maxx, *ptr, *end;
39 T((T_CALLED("wclrtoeol(%p)"), win));
45 * We don't want to clear if we just wrapped the cursor. There's no
46 * point in clearing if we're not on a legal position, either.
48 if (win->_flags & _WRAPPED
53 end = &win->_line[y].text[win->_maxx];
55 maxx = &win->_line[y].text[x];
57 for (ptr = maxx; ptr <= end; ptr++) {
58 chtype blank = _nc_background(win);
62 if (minx == _NOCHANGE)
63 minx = ptr - win->_line[y].text;
68 if (minx != _NOCHANGE) {
69 if (win->_line[y].firstchar > minx || win->_line[y].firstchar == _NOCHANGE)
70 win->_line[y].firstchar = minx;
72 if (win->_line[y].lastchar < maxx - win->_line[y].text)
73 win->_line[y].lastchar = maxx - win->_line[y].text;