* Copyright (c) 1981 Regents of the University of California.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
static char sccsid
[] = "@(#)refresh.c 5.5 (Berkeley) 3/3/91";
* make the current screen look like "win" over the area coverd by
STATIC
int domvcur(), makech();
* make sure were in visual state
* initialize loop parameters
curwin
= (win
== curscr
);
if (win
->_clear
|| curscr
->_clear
|| curwin
) {
if ((win
->_flags
& _FULLWIN
) || curscr
->_clear
) {
fprintf(outf
, "REFRESH(%0.2o): curwin = %d\n", win
, curwin
);
fprintf(outf
, "REFRESH:\n\tfirstch\tlastch\n");
for (wy
= 0; wy
< win
->_maxy
; wy
++) {
fprintf(outf
, "%d\t%d\t%d\n", wy
, win
->_firstch
[wy
],
if (win
->_firstch
[wy
] != _NOCHANGE
)
if (makech(win
, wy
) == ERR
)
if (win
->_firstch
[wy
] >= win
->_ch_off
)
win
->_firstch
[wy
] = win
->_maxx
+
if (win
->_lastch
[wy
] < win
->_maxx
+
win
->_lastch
[wy
] = win
->_ch_off
;
if (win
->_lastch
[wy
] < win
->_firstch
[wy
])
win
->_firstch
[wy
] = _NOCHANGE
;
fprintf(outf
, "\t%d\t%d\n", win
->_firstch
[wy
],
domvcur(ly
, lx
, win
->_cury
, win
->_curx
);
if (ly
>= 0 && ly
< win
->_maxy
&& lx
>= 0 &&
win
->_cury
= win
->_curx
= 0;
domvcur(ly
, lx
, win
->_cury
+ win
->_begy
,
win
->_curx
+ win
->_begx
);
curscr
->_cury
= win
->_cury
+ win
->_begy
;
curscr
->_curx
= win
->_curx
+ win
->_begx
;
* make a change on the screen
reg chtype
*nsp
, *csp
, *ce
;
reg
int nlsp
, clsp
; /* last space in lines */
static chtype blank
[] = {' ','\0'};
wx
= win
->_firstch
[wy
] - win
->_ch_off
;
lch
= win
->_lastch
[wy
] - win
->_ch_off
;
else if (lch
>= win
->_maxx
)
csp
= &curscr
->_y
[wy
+ win
->_begy
][wx
+ win
->_begx
];
for (ce
= &win
->_y
[wy
][win
->_maxx
- 1]; *ce
== ' '; ce
--)
domvcur(ly
, lx
, y
, wx
+ win
->_begx
);
fprintf(outf
, "MAKECH: 1: wx = %d, lx = %d\n", wx
, lx
);
while (*nsp
!= *csp
&& wx
<= lch
) {
if (ce_tcap
!= NULL
&& wx
>= nlsp
&& *nsp
== ' ') {
* check for clear to end-of-line
ce
= &curscr
->_y
[ly
][COLS
- 1];
clsp
= ce
- curscr
->_y
[ly
] - win
->_begx
;
fprintf(outf
, "MAKECH: clsp = %d, nlsp = %d\n", clsp
, nlsp
);
if (clsp
- nlsp
>= strlen(CE
)
fprintf(outf
, "MAKECH: using CE\n");
* enter/exit standout mode as appropriate
if (SO
&& (*nsp
&_STANDOUT
) != (curscr
->_flags
&_STANDOUT
)) {
curscr
->_flags
|= _STANDOUT
;
curscr
->_flags
&= ~_STANDOUT
;
if (wx
>= win
->_maxx
&& wy
== win
->_maxy
- 1)
if ((curscr
->_flags
&_STANDOUT
) &&
(win
->_flags
& _ENDLINE
))
curscr
->_flags
&= ~_STANDOUT
;
if (win
->_flags
&_FULLWIN
&& !curwin
)
ly
= win
->_begy
+win
->_cury
;
lx
= win
->_begx
+win
->_curx
;
else if (win
->_flags
&_SCROLLWIN
) {
_putchar((*csp
++ = *nsp
));
"MAKECH:putchar(%c)\n", *nsp
);
if (UC
&& (*nsp
& _STANDOUT
)) {
fprintf(outf
, "MAKECH: 2: wx = %d, lx = %d\n", wx
, lx
);
if (lx
== wx
+ win
->_begx
) /* if no change */
* xn glitch: chomps a newline after auto-wrap.
* we just feed it now and forget about it.
while (*nsp
== *csp
&& wx
<= lch
) {
fprintf(outf
, "MAKECH: 3: wx = %d, lx = %d\n", wx
, lx
);
* perform a mvcur, leaving standout mode if necessary
if (curscr
->_flags
& _STANDOUT
&& !MS
) {
curscr
->_flags
&= ~_STANDOUT
;