Commit | Line | Data |
---|---|---|
60de5df9 | 1 | /* |
46e9ea25 KB |
2 | * Copyright (c) 1983 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
3dd3a9e5 KB |
5 | * This code is derived from software contributed to Berkeley by |
6 | * Edward Wang at The University of California, Berkeley. | |
7 | * | |
87f529ec | 8 | * %sccs.include.redist.c% |
60de5df9 EW |
9 | */ |
10 | ||
46e9ea25 | 11 | #ifndef lint |
3dd3a9e5 | 12 | static char sccsid[] = "@(#)wwinsline.c 3.12 (Berkeley) %G%"; |
46e9ea25 KB |
13 | #endif /* not lint */ |
14 | ||
2c7129ee EW |
15 | #include "ww.h" |
16 | ||
f2a77fe1 | 17 | wwinsline(w, row) |
2c7129ee | 18 | register struct ww *w; |
f2a77fe1 | 19 | int row; |
2c7129ee EW |
20 | { |
21 | register i; | |
14f251df | 22 | register union ww_char **cpp, **cqq; |
74f2441e | 23 | register union ww_char *cp; |
f2a77fe1 | 24 | int row1, row2; |
14f251df | 25 | char deleted; |
74f2441e | 26 | int visible; |
2c7129ee EW |
27 | |
28 | /* | |
14f251df | 29 | * Scroll first. |
2c7129ee | 30 | */ |
f2a77fe1 EW |
31 | if ((row1 = row) < w->ww_i.t) { |
32 | row1 = w->ww_i.t; | |
74f2441e EW |
33 | visible = 0; |
34 | } else | |
35 | visible = 1; | |
f2a77fe1 EW |
36 | if ((row2 = w->ww_b.b) > w->ww_i.b) { |
37 | row2 = w->ww_i.b; | |
38 | } | |
39 | deleted = wwscroll1(w, row1, row2, -1, visible); | |
14f251df | 40 | |
2c7129ee | 41 | /* |
14f251df EW |
42 | * Fix the buffer. |
43 | * But leave clearing the last line for wwclreol(). | |
2c7129ee | 44 | */ |
f2a77fe1 | 45 | cpp = &w->ww_buf[w->ww_b.b]; |
14f251df | 46 | cqq = cpp - 1; |
74f2441e | 47 | cp = *cqq; |
f2a77fe1 | 48 | for (i = w->ww_b.b - row; --i > 0;) |
14f251df | 49 | *--cpp = *--cqq; |
74f2441e | 50 | *cqq = cp; |
2c7129ee | 51 | |
2c7129ee | 52 | /* |
14f251df | 53 | * Now clear the last line. |
2c7129ee | 54 | */ |
74f2441e | 55 | if (visible) |
f2a77fe1 | 56 | wwclreol1(w, row, w->ww_b.l, deleted); |
b118154f EW |
57 | else { |
58 | cp += w->ww_b.l; | |
f2a77fe1 | 59 | for (i = w->ww_b.nc; --i >= 0;) |
74f2441e | 60 | cp++->c_w = ' '; |
b118154f | 61 | } |
2c7129ee | 62 | } |