]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_clreol.c
ncurses 5.0
[ncurses.git] / ncurses / base / lib_clreol.c
similarity index 73%
rename from ncurses/lib_clreol.c
rename to ncurses/base/lib_clreol.c
index a418c509f31f2965d585c730c92a1b7acd37345b..0c7522278e382aa440ca65e8ec9d25d34cba1bc2 100644 (file)
 
 #include <curses.priv.h>
 
-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);
 }