1: #ifndef lint
2: static char sccsid[] = "@(#)wwdelchar.c 3.11 4/24/85";
3: #endif
4:
5: /*
6: * Copyright (c) 1983 Regents of the University of California,
7: * All rights reserved. Redistribution permitted subject to
8: * the terms of the Berkeley Software License Agreement.
9: */
10:
11: #include "ww.h"
12: #include "tt.h"
13:
14: wwdelchar(w, row, col)
15: register struct ww *w;
16: {
17: register i;
18: int nvis;
19:
20: /*
21: * First, shift the line.
22: */
23: {
24: register union ww_char *p, *q;
25:
26: p = &w->ww_buf[row][col];
27: q = p + 1;
28: for (i = w->ww_b.r - col; --i > 0;)
29: *p++ = *q++;
30: p->c_w = ' ';
31: }
32:
33: /*
34: * If can't see it, just return.
35: */
36: if (row < w->ww_i.t || row >= w->ww_i.b
37: || w->ww_i.r <= 0 || w->ww_i.r <= col)
38: return;
39:
40: if (col < w->ww_i.l)
41: col = w->ww_i.l;
42:
43: /*
44: * Now find out how much is actually changed, and fix wwns.
45: */
46: {
47: register union ww_char *buf;
48: register char *win;
49: register union ww_char *ns;
50: register char *smap;
51: char touched;
52:
53: nvis = 0;
54: smap = &wwsmap[row][col];
55: for (i = col; i < w->ww_i.r && *smap++ != w->ww_index; i++)
56: ;
57: if (i >= w->ww_i.r)
58: return;
59: col = i;
60: buf = w->ww_buf[row];
61: win = w->ww_win[row];
62: ns = wwns[row];
63: smap = &wwsmap[row][i];
64: touched = wwtouched[row];
65: for (; i < w->ww_i.r; i++) {
66: if (*smap++ != w->ww_index)
67: continue;
68: touched |= WWU_TOUCHED;
69: if (win[i])
70: ns[i].c_w =
71: buf[i].c_w ^ win[i] << WWC_MSHIFT;
72: else {
73: nvis++;
74: ns[i] = buf[i];
75: }
76: }
77: wwtouched[row] = touched;
78: }
79:
80: /*
81: * Can/Should we use delete character?
82: */
83: if (tt.tt_delchar != 0 && nvis > (wwncol - col) / 2) {
84: register union ww_char *p, *q;
85:
86: (*tt.tt_move)(row, col);
87: (*tt.tt_delchar)();
88:
89: p = &wwos[row][col];
90: q = p + 1;
91: for (i = wwncol - col; --i > 0;)
92: *p++ = *q++;
93: p->c_w = ' ';
94: }
95: }
Defined functions
Defined variables
sccsid
defined in line
2;
never used