xref: /csrg-svn/lib/libcurses/clrtobot.c (revision 67082)
122654Sdist /*
2*67082Sbostic  * Copyright (c) 1981, 1993, 1994
361262Sbostic  *	The Regents of the University of California.  All rights reserved.
434677Sbostic  *
542653Sbostic  * %sccs.include.redist.c%
622654Sdist  */
722654Sdist 
822654Sdist #ifndef lint
9*67082Sbostic static char sccsid[] = "@(#)clrtobot.c	8.2 (Berkeley) 05/04/94";
1055950Sbostic #endif	/* not lint */
1122654Sdist 
12*67082Sbostic #include "curses.h"
132240Sarnold 
142240Sarnold /*
1555950Sbostic  * wclrtobot --
1655950Sbostic  *	Erase everything on the window.
172240Sarnold  */
1855950Sbostic int
wclrtobot(win)192240Sarnold wclrtobot(win)
2055950Sbostic 	register WINDOW *win;
2155950Sbostic {
2259773Selan 	register int minx, startx, starty, y;
2356647Selan 	register __LDATA *sp, *end, *maxx;
242240Sarnold 
2559773Selan 	if (win->lines[win->cury]->flags & __ISPASTEOL) {
2659773Selan 		starty = win->cury + 1;
2759773Selan 		startx = 0;
2859773Selan 	} else {
2959773Selan 		starty = win->cury;
3059773Selan 		startx = win->curx;
3159773Selan 	}
3259773Selan 	for (y = starty; y < win->maxy; y++) {
3356238Selan 		minx = -1;
3456238Selan 		end = &win->lines[y]->line[win->maxx];
3556238Selan 		for (sp = &win->lines[y]->line[startx]; sp < end; sp++)
3656647Selan 			if (sp->ch != ' ' || sp->attr != 0) {
372240Sarnold 				maxx = sp;
3856238Selan 				if (minx == -1)
3956238Selan 					minx = sp - win->lines[y]->line;
4056647Selan 				sp->ch = ' ';
4156647Selan 				sp->attr = 0;
422240Sarnold 			}
4356238Selan 		if (minx != -1)
4456650Selan 			__touchline(win, y, minx, maxx - win->lines[y]->line,
4556650Selan 		            0);
462240Sarnold 		startx = 0;
472240Sarnold 	}
4857472Sbostic 	return (OK);
492240Sarnold }
50