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 | |
1589e7d3 | 9 | static char sccsid[] = "@(#)clrtoeol.c 5.7 (Berkeley) %G%"; |
501b3d1f | 10 | #endif /* not lint */ |
6e1c93d0 | 11 | |
501b3d1f | 12 | #include <curses.h> |
e6f2eb0e KA |
13 | |
14 | /* | |
501b3d1f KB |
15 | * wclrtoeol -- |
16 | * Clear up to the end of line. | |
e6f2eb0e | 17 | */ |
501b3d1f | 18 | int |
e6f2eb0e | 19 | wclrtoeol(win) |
501b3d1f KB |
20 | register WINDOW *win; |
21 | { | |
22 | register int minx, x, y; | |
23 | register char *end, *maxx, *sp; | |
e6f2eb0e | 24 | |
0c5c5188 EA |
25 | y = win->cury; |
26 | x = win->curx; | |
27 | end = &win->lines[y]->line[win->maxx]; | |
28 | minx = -1; | |
29 | maxx = &win->lines[y]->line[x]; | |
e6f2eb0e | 30 | for (sp = maxx; sp < end; sp++) |
1589e7d3 | 31 | if (*sp != ' ' || *(sp + win->maxx) & __STANDOUT) { |
e6f2eb0e | 32 | maxx = sp; |
0c5c5188 EA |
33 | if (minx == -1) |
34 | minx = sp - win->lines[y]->line; | |
e6f2eb0e | 35 | *sp = ' '; |
1589e7d3 | 36 | *(sp + win->maxx) &= ~__STANDOUT; |
e6f2eb0e | 37 | } |
501b3d1f KB |
38 | #ifdef DEBUG |
39 | __TRACE("CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", | |
0c5c5188 EA |
40 | minx, maxx - win->lines[y]->line, win->lines[y]->firstch, |
41 | win->lines[y]->lastch); | |
501b3d1f KB |
42 | #endif |
43 | /* Update firstch and lastch for the line. */ | |
0c5c5188 | 44 | return (touchline(win, y, win->curx, win->maxx - 1)); |
e6f2eb0e | 45 | } |