X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/7edc52eca56cdeba9b74d0bc01ca4b0c27640b5a..d93758100f2a0e2107957c31450a3e9c6bf278b8:/usr/src/usr.bin/window/wwwrite.c diff --git a/usr/src/usr.bin/window/wwwrite.c b/usr/src/usr.bin/window/wwwrite.c index dcc88b1a40..90cf59bfe1 100644 --- a/usr/src/usr.bin/window/wwwrite.c +++ b/usr/src/usr.bin/window/wwwrite.c @@ -1,11 +1,33 @@ +/* + * 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.21 %G%"; -#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 @@ -38,8 +60,8 @@ int n; 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; @@ -58,7 +80,7 @@ int n; 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; } @@ -102,14 +124,9 @@ int n; 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; @@ -121,6 +138,7 @@ int n; 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) { @@ -142,10 +160,10 @@ int n; 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; } @@ -158,6 +176,7 @@ int n; 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) { @@ -185,6 +204,7 @@ int n; 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; @@ -195,6 +215,7 @@ int n; wwclreol(w, w->ww_cur.r, w->ww_cur.c); break; case 'L': + UPDATE(); wwinsline(w, w->ww_cur.r); break; case 'M': @@ -206,26 +227,22 @@ int n; 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; @@ -239,6 +256,14 @@ int n; (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)