|
|
1.1 ! root 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[] = "@(#)wwdelchar.c 3.13 (Berkeley) 6/29/88"; ! 20: #endif /* not lint */ ! 21: ! 22: #include "ww.h" ! 23: #include "tt.h" ! 24: ! 25: wwdelchar(w, row, col) ! 26: register struct ww *w; ! 27: { ! 28: register i; ! 29: int nvis; ! 30: ! 31: /* ! 32: * First, shift the line. ! 33: */ ! 34: { ! 35: register union ww_char *p, *q; ! 36: ! 37: p = &w->ww_buf[row][col]; ! 38: q = p + 1; ! 39: for (i = w->ww_b.r - col; --i > 0;) ! 40: *p++ = *q++; ! 41: p->c_w = ' '; ! 42: } ! 43: ! 44: /* ! 45: * If can't see it, just return. ! 46: */ ! 47: if (row < w->ww_i.t || row >= w->ww_i.b ! 48: || w->ww_i.r <= 0 || w->ww_i.r <= col) ! 49: return; ! 50: ! 51: if (col < w->ww_i.l) ! 52: col = w->ww_i.l; ! 53: ! 54: /* ! 55: * Now find out how much is actually changed, and fix wwns. ! 56: */ ! 57: { ! 58: register union ww_char *buf; ! 59: register char *win; ! 60: register union ww_char *ns; ! 61: register char *smap; ! 62: char touched; ! 63: ! 64: nvis = 0; ! 65: smap = &wwsmap[row][col]; ! 66: for (i = col; i < w->ww_i.r && *smap++ != w->ww_index; i++) ! 67: ; ! 68: if (i >= w->ww_i.r) ! 69: return; ! 70: col = i; ! 71: buf = w->ww_buf[row]; ! 72: win = w->ww_win[row]; ! 73: ns = wwns[row]; ! 74: smap = &wwsmap[row][i]; ! 75: touched = wwtouched[row]; ! 76: for (; i < w->ww_i.r; i++) { ! 77: if (*smap++ != w->ww_index) ! 78: continue; ! 79: touched |= WWU_TOUCHED; ! 80: if (win[i]) ! 81: ns[i].c_w = ! 82: buf[i].c_w ^ win[i] << WWC_MSHIFT; ! 83: else { ! 84: nvis++; ! 85: ns[i] = buf[i]; ! 86: } ! 87: } ! 88: wwtouched[row] = touched; ! 89: } ! 90: ! 91: /* ! 92: * Can/Should we use delete character? ! 93: */ ! 94: if (tt.tt_delchar != 0 && nvis > (wwncol - col) / 2) { ! 95: register union ww_char *p, *q; ! 96: ! 97: (*tt.tt_move)(row, col); ! 98: (*tt.tt_delchar)(); ! 99: ! 100: p = &wwos[row][col]; ! 101: q = p + 1; ! 102: for (i = wwncol - col; --i > 0;) ! 103: *p++ = *q++; ! 104: p->c_w = ' '; ! 105: } ! 106: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.