diff options
Diffstat (limited to 'lib/libcurses/clrtoeol.c')
| -rw-r--r-- | lib/libcurses/clrtoeol.c | 70 |
1 files changed, 41 insertions, 29 deletions
diff --git a/lib/libcurses/clrtoeol.c b/lib/libcurses/clrtoeol.c index 6af2bfcededf..6fa63b420615 100644 --- a/lib/libcurses/clrtoeol.c +++ b/lib/libcurses/clrtoeol.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 1981 Regents of the University of California. - * All rights reserved. + * Copyright (c) 1981, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,40 +32,52 @@ */ #ifndef lint -static char sccsid[] = "@(#)clrtoeol.c 5.4 (Berkeley) 6/1/90"; -#endif /* not lint */ +static char sccsid[] = "@(#)clrtoeol.c 8.1 (Berkeley) 6/4/93"; +#endif /* not lint */ -# include "curses.ext" +#include <curses.h> /* - * This routine clears up to the end of line - * + * wclrtoeol -- + * Clear up to the end of line. */ +int wclrtoeol(win) -reg WINDOW *win; { - - reg chtype *sp, *end; - reg int y, x; - reg chtype *maxx; - reg int minx; + register WINDOW *win; +{ + register int minx, x, y; + register __LDATA *end, *maxx, *sp; - y = win->_cury; - x = win->_curx; - end = &win->_y[y][win->_maxx]; - minx = _NOCHANGE; - maxx = &win->_y[y][x]; + y = win->cury; + x = win->curx; + if (win->lines[y]->flags & __ISPASTEOL) { + if (y < win->maxy - 1) { + y++; + x = 0; + } else + return (OK); + } + end = &win->lines[y]->line[win->maxx]; + minx = -1; + maxx = &win->lines[y]->line[x]; for (sp = maxx; sp < end; sp++) - if (*sp != ' ') { + if (sp->ch != ' ' || sp->attr != 0) { maxx = sp; - if (minx == _NOCHANGE) - minx = sp - win->_y[y]; - *sp = ' '; + if (minx == -1) + minx = sp - win->lines[y]->line; + sp->ch = ' '; + sp->attr = 0; } - /* - * update firstch and lastch for the line - */ - touchline(win, y, win->_curx, win->_maxx - 1); -# ifdef DEBUG - fprintf(outf, "CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", minx, maxx - win->_y[y], win->_firstch[y], win->_lastch[y]); -# endif +#ifdef DEBUG + __CTRACE("CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", + minx, maxx - win->lines[y]->line, *win->lines[y]->firstchp, + *win->lines[y]->lastchp); +#endif + /* Update firstch and lastch for the line. */ + return (__touchline(win, y, x, win->maxx - 1, 0)); } + + + + + |
