+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
#ifndef lint
-static char *sccsid = "@(#)wwwrite.c 3.20 84/04/09";
-#endif
+static char sccsid[] = "@(#)wwwrite.c 3.30 (Berkeley) %G%";
+#endif /* not lint */
#include "ww.h"
#include "tt.h"
#include "char.h"
+#define UPDATE() \
+ if (!w->ww_noupdate && w->ww_cur.r >= 0 && w->ww_cur.r < wwnrow && \
+ wwtouched[w->ww_cur.r]) \
+ wwupdate1(w->ww_cur.r, w->ww_cur.r + 1)
+
/*
* To support control character expansion, we save the old
* p and q values in r and s, and point p at the beginning
r = 0;
continue;
}
- if (w->ww_wstate == 0 && (isprt(*p)
- || w->ww_unctrl && isunctrl(*p))) {
+ if (w->ww_wstate == 0 &&
+ (isprt(*p) || w->ww_unctrl && isunctrl(*p))) {
register i;
register union ww_char *bp;
int col, col1;
q = p + 10;
}
wwinschar(w, w->ww_cur.r, w->ww_cur.c,
- *p++ | w->ww_modes << WWC_MSHIFT);
+ *p++, w->ww_modes);
goto right;
}
ns[i].c_w = bp[i].c_w
^ win[i] << WWC_MSHIFT;
}
- if (nchanged > 0) {
+ if (nchanged > 0)
wwtouched[w->ww_cur.r] |= WWU_TOUCHED;
- if (!w->ww_noupdate)
- wwupdate1(w->ww_cur.r,
- w->ww_cur.r + 1);
- }
}
-
chklf:
if (w->ww_cur.c >= w->ww_w.r)
goto crlf;
crlf:
w->ww_cur.c = w->ww_w.l;
lf:
+ UPDATE();
if (++w->ww_cur.r >= w->ww_w.b) {
w->ww_cur.r = w->ww_w.b - 1;
if (w->ww_w.b < w->ww_b.b) {
case '\r':
w->ww_cur.c = w->ww_w.l;
break;
- case ctrl(g):
- ttputc(ctrl(g));
+ case ctrl('g'):
+ ttputc(ctrl('g'));
break;
- case ctrl([):
+ case ctrl('['):
w->ww_wstate = 1;
break;
}
break;
case 'A':
up:
+ UPDATE();
if (--w->ww_cur.r < w->ww_w.t) {
w->ww_cur.r = w->ww_w.t;
if (w->ww_w.t > w->ww_b.t) {
wwclreos(w, w->ww_w.t, w->ww_w.l);
break;
case 'H':
+ UPDATE();
w->ww_cur.r = w->ww_w.t;
w->ww_cur.c = w->ww_w.l;
break;
wwclreol(w, w->ww_cur.r, w->ww_cur.c);
break;
case 'L':
+ UPDATE();
wwinsline(w, w->ww_cur.r);
break;
case 'M':
case 'O':
w->ww_insert = 0;
break;
+ case 'X':
+ wwupdate();
+ break;
case 'Y':
+ UPDATE();
w->ww_wstate = 2;
break;
- case 'p':
- w->ww_modes |= WWM_REV;
- break;
- case 'q':
- w->ww_modes &= ~WWM_REV;
- break;
- case 'r':
- w->ww_modes |= WWM_UL;
+ case 'Z':
+ wwupdate();
+ xxflush(0);
break;
case 's':
- w->ww_modes &= ~WWM_UL;
+ w->ww_wstate = 4;
break;
- case 'F':
- w->ww_modes |= WWM_GRP;
- break;
- case 'G':
- w->ww_modes &= ~WWM_GRP;
+ case 'r':
+ w->ww_wstate = 5;
break;
}
break;
(unsigned)(*p++ - ' ') % w->ww_w.nc;
w->ww_wstate = 0;
break;
+ case 4:
+ w->ww_modes |= *p++ & wwavailmodes;
+ w->ww_wstate = 0;
+ break;
+ case 5:
+ w->ww_modes &= ~*p++;
+ w->ww_wstate = 0;
+ break;
}
}
if (hascursor)