Commit | Line | Data |
---|---|---|
2c7129ee | 1 | #ifndef lint |
74f2441e | 2 | static char *sccsid = "@(#)wwinsline.c 3.3 83/08/18"; |
2c7129ee EW |
3 | #endif |
4 | ||
5 | #include "ww.h" | |
6 | ||
7 | wwinsline(w, line) | |
8 | register struct ww *w; | |
9 | int line; | |
10 | { | |
11 | register i; | |
14f251df | 12 | register union ww_char **cpp, **cqq; |
74f2441e | 13 | register union ww_char *cp; |
14f251df EW |
14 | int srow, erow; |
15 | char deleted; | |
74f2441e | 16 | int visible; |
2c7129ee EW |
17 | |
18 | /* | |
14f251df | 19 | * Scroll first. |
2c7129ee | 20 | */ |
74f2441e | 21 | if ((srow = line - w->ww_scroll) < 0) { |
14f251df | 22 | srow = 0; |
74f2441e EW |
23 | visible = 0; |
24 | } else | |
25 | visible = 1; | |
14f251df EW |
26 | if ((erow = w->ww_nline - w->ww_scroll - 1) >= w->ww_w.nr) |
27 | erow = w->ww_w.nr - 1; | |
74f2441e | 28 | deleted = wwscroll1(w, srow, erow, -1, visible); |
14f251df | 29 | |
2c7129ee | 30 | /* |
14f251df EW |
31 | * Fix the buffer. |
32 | * But leave clearing the last line for wwclreol(). | |
2c7129ee | 33 | */ |
14f251df EW |
34 | cpp = &w->ww_buf[w->ww_nline]; |
35 | cqq = cpp - 1; | |
74f2441e | 36 | cp = *cqq; |
14f251df EW |
37 | for (i = w->ww_nline - line - 1; --i >= 0;) |
38 | *--cpp = *--cqq; | |
74f2441e | 39 | *cqq = cp; |
2c7129ee | 40 | |
2c7129ee | 41 | /* |
14f251df | 42 | * Now clear the last line. |
2c7129ee | 43 | */ |
74f2441e EW |
44 | if (visible) |
45 | wwclreol1(w, line, 0, deleted); | |
46 | else | |
47 | for (i = w->ww_w.nc; --i >= 0;) | |
48 | cp++->c_w = ' '; | |
2c7129ee | 49 | } |