Commit | Line | Data |
---|---|---|
87c6fcf8 DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | */ | |
6 | ||
7 | #ifndef lint | |
8 | static char sccsid[] = "@(#)insertln.c 5.1 (Berkeley) %G%"; | |
9 | #endif not lint | |
10 | ||
259c2c61 KA |
11 | # include "curses.ext" |
12 | ||
13 | /* | |
14 | * This routine performs an insert-line on the window, leaving | |
15 | * (_cury,_curx) unchanged. | |
16 | * | |
259c2c61 KA |
17 | */ |
18 | winsertln(win) | |
19 | reg WINDOW *win; { | |
20 | ||
21 | reg char *temp; | |
22 | reg int y; | |
23 | reg char *end; | |
e3fd04f0 | 24 | reg int x; |
259c2c61 | 25 | |
e3fd04f0 JB |
26 | #ifdef DEBUG |
27 | fprintf(outf, "INSERTLN(%0.2o)\n", win); | |
28 | #endif | |
29 | if (win->_orig == NULL) | |
30 | temp = win->_y[win->_maxy - 1]; | |
259c2c61 | 31 | for (y = win->_maxy - 1; y > win->_cury; --y) { |
e3fd04f0 JB |
32 | if (win->_orig == NULL) |
33 | win->_y[y] = win->_y[y - 1]; | |
34 | else | |
35 | bcopy(win->_y[y - 1], win->_y[y], win->_maxx); | |
36 | touchline(win, y, 0, win->_maxx - 1); | |
259c2c61 | 37 | } |
e3fd04f0 JB |
38 | if (win->_orig == NULL) |
39 | win->_y[y] = temp; | |
40 | else | |
41 | temp = win->_y[y]; | |
259c2c61 KA |
42 | for (end = &temp[win->_maxx]; temp < end; ) |
43 | *temp++ = ' '; | |
e3fd04f0 JB |
44 | touchline(win, y, 0, win->_maxx - 1); |
45 | if (win->_orig == NULL) | |
46 | _id_subwins(win); | |
259c2c61 | 47 | } |