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