1 /* 2 * Copyright (c) 1983 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that the above copyright notice and this paragraph are 7 * duplicated in all such forms and that any documentation, 8 * advertising materials, and other materials related to such 9 * distribution and use acknowledge that the software was developed 10 * by the University of California, Berkeley. The name of the 11 * University may not be used to endorse or promote products derived 12 * from this software without specific prior written permission. 13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 */ 17 18 #ifndef lint 19 static char sccsid[] = "@(#)wwinsline.c 3.10 (Berkeley) 06/29/88"; 20 #endif /* not lint */ 21 22 #include "ww.h" 23 24 wwinsline(w, row) 25 register struct ww *w; 26 int row; 27 { 28 register i; 29 register union ww_char **cpp, **cqq; 30 register union ww_char *cp; 31 int row1, row2; 32 char deleted; 33 int visible; 34 35 /* 36 * Scroll first. 37 */ 38 if ((row1 = row) < w->ww_i.t) { 39 row1 = w->ww_i.t; 40 visible = 0; 41 } else 42 visible = 1; 43 if ((row2 = w->ww_b.b) > w->ww_i.b) { 44 row2 = w->ww_i.b; 45 } 46 deleted = wwscroll1(w, row1, row2, -1, visible); 47 48 /* 49 * Fix the buffer. 50 * But leave clearing the last line for wwclreol(). 51 */ 52 cpp = &w->ww_buf[w->ww_b.b]; 53 cqq = cpp - 1; 54 cp = *cqq; 55 for (i = w->ww_b.b - row; --i > 0;) 56 *--cpp = *--cqq; 57 *cqq = cp; 58 59 /* 60 * Now clear the last line. 61 */ 62 if (visible) 63 wwclreol1(w, row, w->ww_b.l, deleted); 64 else { 65 cp += w->ww_b.l; 66 for (i = w->ww_b.nc; --i >= 0;) 67 cp++->c_w = ' '; 68 } 69 } 70