X-Git-Url: http://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=ncurses%2Fbase%2Flib_clreol.c;fp=ncurses%2Flib_clreol.c;h=0c7522278e382aa440ca65e8ec9d25d34cba1bc2;hb=0eb88fc5281804773e2a0c7a488a4452463535ce;hp=a418c509f31f2965d585c730c92a1b7acd37345b;hpb=661078ddbde3ce0f3b06e95642fbb9b5fef7dca1;p=ncurses.git diff --git a/ncurses/lib_clreol.c b/ncurses/base/lib_clreol.c similarity index 73% rename from ncurses/lib_clreol.c rename to ncurses/base/lib_clreol.c index a418c509..0c752227 100644 --- a/ncurses/lib_clreol.c +++ b/ncurses/base/lib_clreol.c @@ -41,54 +41,51 @@ #include -MODULE_ID("$Id: lib_clreol.c,v 1.14 1998/02/11 12:13:55 tom Exp $") +MODULE_ID("$Id: lib_clreol.c,v 1.15 1998/06/28 00:32:20 tom Exp $") int wclrtoeol(WINDOW *win) { int code = ERR; -chtype blank; -chtype *ptr, *end; -short y, x; T((T_CALLED("wclrtoeol(%p)"), win)); if (win) { + chtype blank; + chtype *ptr, *end; + struct ldat *line; + short y = win->_cury; + short x = win->_curx; - y = win->_cury; - x = win->_curx; + /* + * If we have just wrapped the cursor, the clear applies to the + * new line, unless we are at the lower right corner. + */ + if (win->_flags & _WRAPPED + && y < win->_maxy) { + win->_flags &= ~_WRAPPED; + } - /* - * If we have just wrapped the cursor, the clear applies to the new - * line, unless we are at the lower right corner. - */ - if (win->_flags & _WRAPPED - && y < win->_maxy) { - win->_flags &= ~_WRAPPED; - } - - /* - * There's no point in clearing if we're not on a legal position, - * either. - */ - if (win->_flags & _WRAPPED - || y > win->_maxy - || x > win->_maxx) - returnCode(ERR); - - blank = _nc_background(win); - end = &win->_line[y].text[win->_maxx]; - - for (ptr = &win->_line[y].text[x]; ptr <= end; ptr++) - *ptr = blank; - - if (win->_line[y].firstchar > win->_curx - || win->_line[y].firstchar == _NOCHANGE) - win->_line[y].firstchar = win->_curx; - - win->_line[y].lastchar = win->_maxx; - - _nc_synchook(win); - code = OK; + /* + * There's no point in clearing if we're not on a legal + * position, either. + */ + if (win->_flags & _WRAPPED + || y > win->_maxy + || x > win->_maxx) + returnCode(ERR); + + blank = _nc_background(win); + line = &win->_line[y]; + CHANGED_TO_EOL(line, x, win->_maxx); + + ptr = &(line->text[x]); + end = &(line->text[win->_maxx]); + + while (ptr <= end) + *ptr++ = blank; + + _nc_synchook(win); + code = OK; } returnCode(code); }