xref: /original-bsd/lib/libcurses/deleteln.c (revision c3e32dec)
1 /*
2  * Copyright (c) 1981, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)deleteln.c	8.1 (Berkeley) 06/04/93";
10 #endif	/* not lint */
11 
12 #include <curses.h>
13 #include <string.h>
14 
15 /*
16  * wdeleteln --
17  *	Delete a line from the screen.  It leaves (cury, curx) unchanged.
18  */
19 int
20 wdeleteln(win)
21 	register WINDOW *win;
22 {
23 	register int y, i;
24 	register __LINE *temp;
25 
26 #ifdef DEBUG
27 	__CTRACE("deleteln: (%0.2o)\n", win);
28 #endif
29 	temp = win->lines[win->cury];
30 	for (y = win->cury; y < win->maxy - 1; y++) {
31 		win->lines[y]->flags &= ~__ISPASTEOL;
32 		win->lines[y + 1]->flags &= ~__ISPASTEOL;
33 		if (win->orig == NULL)
34 			win->lines[y] = win->lines[y + 1];
35 		else
36 			(void) memcpy(win->lines[y]->line,
37 			    win->lines[y + 1]->line,
38 			    win->maxx * __LDATASIZE);
39 		__touchline(win, y, 0, win->maxx - 1, 0);
40 	}
41 
42 	if (win->orig == NULL)
43 		win->lines[y] = temp;
44 	else
45 		temp = win->lines[y];
46 
47 	for(i = 0; i < win->maxx; i++) {
48 		temp->line[i].ch = ' ';
49 		temp->line[i].attr = 0;
50 	}
51 	__touchline(win, y, 0, win->maxx - 1, 0);
52 	if (win->orig == NULL)
53 		__id_subwins(win);
54 	return (OK);
55 }
56