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 this notice is preserved and that due credit is given 7 * to the University of California at Berkeley. The name of the University 8 * may not be used to endorse or promote products derived from this 9 * software without specific prior written permission. This software 10 * is provided ``as is'' without express or implied warranty. 11 */ 12 13 #ifndef lint 14 static char sccsid[] = "@(#)wwdelline.c 3.9 (Berkeley) 03/08/88"; 15 #endif /* not lint */ 16 17 #include "ww.h" 18 19 wwdelline(w, row) 20 register struct ww *w; 21 int row; 22 { 23 register i; 24 register union ww_char **cpp, **cqq; 25 register union ww_char *cp; 26 int row1, row2; 27 char deleted; 28 int visible; 29 30 /* 31 * Scroll first. 32 */ 33 if ((row1 = row) < w->ww_i.t) { 34 row1 = w->ww_i.t; 35 } 36 if ((row2 = w->ww_b.b) > w->ww_i.b) { 37 row2 = w->ww_i.b; 38 visible = 0; 39 } else 40 visible = 1; 41 deleted = wwscroll1(w, row1, row2, 1, visible); 42 43 /* 44 * Fix the buffer. 45 * But leave clearing the last line for wwclreol(). 46 */ 47 cpp = &w->ww_buf[row]; 48 cqq = cpp + 1; 49 cp = *cpp; 50 for (i = w->ww_b.b - row; --i > 0;) 51 *cpp++ = *cqq++; 52 *cpp = cp; 53 54 /* 55 * Now clear the last line. 56 */ 57 if (visible) 58 wwclreol1(w, w->ww_b.b - 1, w->ww_b.l, deleted); 59 else { 60 cp += w->ww_b.l; 61 for (i = w->ww_b.nc; --i >= 0;) 62 cp++->c_w = ' '; 63 } 64 } 65