Commit | Line | Data |
---|---|---|
6e1c93d0 | 1 | /* |
2f14f200 KB |
2 | * Copyright (c) 1981 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
c07973a2 | 5 | * %sccs.include.redist.c% |
6e1c93d0 DF |
6 | */ |
7 | ||
8 | #ifndef lint | |
c07973a2 | 9 | static char sccsid[] = "@(#)clrtoeol.c 5.4 (Berkeley) %G%"; |
2f14f200 | 10 | #endif /* not lint */ |
6e1c93d0 | 11 | |
e6f2eb0e KA |
12 | # include "curses.ext" |
13 | ||
14 | /* | |
15 | * This routine clears up to the end of line | |
16 | * | |
e6f2eb0e KA |
17 | */ |
18 | wclrtoeol(win) | |
19 | reg WINDOW *win; { | |
20 | ||
21 | reg char *sp, *end; | |
22 | reg int y, x; | |
23 | reg char *maxx; | |
24 | reg int minx; | |
25 | ||
26 | y = win->_cury; | |
27 | x = win->_curx; | |
28 | end = &win->_y[y][win->_maxx]; | |
29 | minx = _NOCHANGE; | |
30 | maxx = &win->_y[y][x]; | |
31 | for (sp = maxx; sp < end; sp++) | |
32 | if (*sp != ' ') { | |
33 | maxx = sp; | |
34 | if (minx == _NOCHANGE) | |
35 | minx = sp - win->_y[y]; | |
36 | *sp = ' '; | |
37 | } | |
38 | /* | |
39 | * update firstch and lastch for the line | |
40 | */ | |
26a29dea | 41 | touchline(win, y, win->_curx, win->_maxx - 1); |
e6f2eb0e KA |
42 | # ifdef DEBUG |
43 | fprintf(outf, "CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", minx, maxx - win->_y[y], win->_firstch[y], win->_lastch[y]); | |
44 | # endif | |
e6f2eb0e | 45 | } |