1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
3*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
4*7c478bd9Sstevel@tonic-gate  */
5*7c478bd9Sstevel@tonic-gate 
6*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
7*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
8*7c478bd9Sstevel@tonic-gate 
9*7c478bd9Sstevel@tonic-gate /*
10*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
11*7c478bd9Sstevel@tonic-gate  * All rights reserved.  The Berkeley software License Agreement
12*7c478bd9Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
13*7c478bd9Sstevel@tonic-gate  */
14*7c478bd9Sstevel@tonic-gate 
15*7c478bd9Sstevel@tonic-gate /*LINTLIBRARY*/
16*7c478bd9Sstevel@tonic-gate 
17*7c478bd9Sstevel@tonic-gate #ifndef lint
18*7c478bd9Sstevel@tonic-gate static char
19*7c478bd9Sstevel@tonic-gate sccsid[] = "@(#)refresh.c 1.8 89/08/24 SMI"; /* from UCB 5.1 85/06/07 */
20*7c478bd9Sstevel@tonic-gate #endif /* not lint */
21*7c478bd9Sstevel@tonic-gate 
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * make the current screen look like "win" over the area coverd by
24*7c478bd9Sstevel@tonic-gate  * win.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #include	"curses.ext"
28*7c478bd9Sstevel@tonic-gate #include	<term.h>
29*7c478bd9Sstevel@tonic-gate #include	<string.h>
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #ifdef DEBUG
32*7c478bd9Sstevel@tonic-gate #define	DEBUGSTATIC
33*7c478bd9Sstevel@tonic-gate #else
34*7c478bd9Sstevel@tonic-gate #define	DEBUGSTATIC	static
35*7c478bd9Sstevel@tonic-gate #endif
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate DEBUGSTATIC short	ly, lx;
38*7c478bd9Sstevel@tonic-gate DEBUGSTATIC bool	curwin;
39*7c478bd9Sstevel@tonic-gate WINDOW	*_win = NULL;
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate /* forward declarations */
42*7c478bd9Sstevel@tonic-gate DEBUGSTATIC void domvcur(int, int, int, int);
43*7c478bd9Sstevel@tonic-gate DEBUGSTATIC int makech(WINDOW *, short);
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate int
wrefresh(WINDOW * win)46*7c478bd9Sstevel@tonic-gate wrefresh(WINDOW *win)
47*7c478bd9Sstevel@tonic-gate {
48*7c478bd9Sstevel@tonic-gate 	short	wy;
49*7c478bd9Sstevel@tonic-gate 	int	retval;
50*7c478bd9Sstevel@tonic-gate 
51*7c478bd9Sstevel@tonic-gate 	/*
52*7c478bd9Sstevel@tonic-gate 	 * make sure were in visual state
53*7c478bd9Sstevel@tonic-gate 	 */
54*7c478bd9Sstevel@tonic-gate 	if (_endwin) {
55*7c478bd9Sstevel@tonic-gate 		(void) _puts(VS);
56*7c478bd9Sstevel@tonic-gate 		(void) _puts(TI);
57*7c478bd9Sstevel@tonic-gate 		_endwin = FALSE;
58*7c478bd9Sstevel@tonic-gate 	}
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate 	/*
61*7c478bd9Sstevel@tonic-gate 	 * initialize loop parameters
62*7c478bd9Sstevel@tonic-gate 	 */
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate 	ly = curscr->_cury;
65*7c478bd9Sstevel@tonic-gate 	lx = curscr->_curx;
66*7c478bd9Sstevel@tonic-gate 	_win = win;
67*7c478bd9Sstevel@tonic-gate 	curwin = (win == curscr);
68*7c478bd9Sstevel@tonic-gate 
69*7c478bd9Sstevel@tonic-gate 	if (win->_clear || curscr->_clear || curwin) {
70*7c478bd9Sstevel@tonic-gate 		if ((win->_flags & _FULLWIN) || curscr->_clear) {
71*7c478bd9Sstevel@tonic-gate 			(void) _puts(CL);
72*7c478bd9Sstevel@tonic-gate 			ly = 0;
73*7c478bd9Sstevel@tonic-gate 			lx = 0;
74*7c478bd9Sstevel@tonic-gate 			if (!curwin) {
75*7c478bd9Sstevel@tonic-gate 				curscr->_clear = FALSE;
76*7c478bd9Sstevel@tonic-gate 				curscr->_cury = 0;
77*7c478bd9Sstevel@tonic-gate 				curscr->_curx = 0;
78*7c478bd9Sstevel@tonic-gate 				(void) werase(curscr);
79*7c478bd9Sstevel@tonic-gate 			}
80*7c478bd9Sstevel@tonic-gate 			(void) touchwin(win);
81*7c478bd9Sstevel@tonic-gate 		}
82*7c478bd9Sstevel@tonic-gate 		win->_clear = FALSE;
83*7c478bd9Sstevel@tonic-gate 	}
84*7c478bd9Sstevel@tonic-gate 	if (!CA) {
85*7c478bd9Sstevel@tonic-gate 		if (win->_curx != 0)
86*7c478bd9Sstevel@tonic-gate 			(void) _putchar('\n');
87*7c478bd9Sstevel@tonic-gate 		if (!curwin)
88*7c478bd9Sstevel@tonic-gate 			(void) werase(curscr);
89*7c478bd9Sstevel@tonic-gate 	}
90*7c478bd9Sstevel@tonic-gate #ifdef DEBUG
91*7c478bd9Sstevel@tonic-gate 	fprintf(outf, "REFRESH(%0.2o): curwin = %d\n", win, curwin);
92*7c478bd9Sstevel@tonic-gate 	fprintf(outf, "REFRESH:\n\tfirstch\tlastch\n");
93*7c478bd9Sstevel@tonic-gate #endif
94*7c478bd9Sstevel@tonic-gate 	for (wy = 0; wy < win->_maxy; wy++) {
95*7c478bd9Sstevel@tonic-gate #ifdef DEBUG
96*7c478bd9Sstevel@tonic-gate 		fprintf(outf, "%d\t%d\t%d\n", wy, win->_firstch[wy],
97*7c478bd9Sstevel@tonic-gate 		    win->_lastch[wy]);
98*7c478bd9Sstevel@tonic-gate #endif
99*7c478bd9Sstevel@tonic-gate 		if (win->_firstch[wy] != _NOCHANGE)
100*7c478bd9Sstevel@tonic-gate 			if (makech(win, wy) == ERR)
101*7c478bd9Sstevel@tonic-gate 				return (ERR);
102*7c478bd9Sstevel@tonic-gate 			else {
103*7c478bd9Sstevel@tonic-gate 				if (win->_firstch[wy] >= win->_ch_off)
104*7c478bd9Sstevel@tonic-gate 					win->_firstch[wy] = win->_maxx +
105*7c478bd9Sstevel@tonic-gate 							    win->_ch_off;
106*7c478bd9Sstevel@tonic-gate 				if (win->_lastch[wy] < win->_maxx +
107*7c478bd9Sstevel@tonic-gate 				    win->_ch_off)
108*7c478bd9Sstevel@tonic-gate 					win->_lastch[wy] = win->_ch_off;
109*7c478bd9Sstevel@tonic-gate 				if (win->_lastch[wy] < win->_firstch[wy])
110*7c478bd9Sstevel@tonic-gate 					win->_firstch[wy] = _NOCHANGE;
111*7c478bd9Sstevel@tonic-gate 			}
112*7c478bd9Sstevel@tonic-gate #ifdef DEBUG
113*7c478bd9Sstevel@tonic-gate 		fprintf(outf, "\t%d\t%d\n", win->_firstch[wy],
114*7c478bd9Sstevel@tonic-gate 		    win->_lastch[wy]);
115*7c478bd9Sstevel@tonic-gate #endif
116*7c478bd9Sstevel@tonic-gate 	}
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate 	if (win == curscr)
119*7c478bd9Sstevel@tonic-gate 		domvcur(ly, lx, win->_cury, win->_curx);
120*7c478bd9Sstevel@tonic-gate 	else {
121*7c478bd9Sstevel@tonic-gate 		if (win->_leave) {
122*7c478bd9Sstevel@tonic-gate 			curscr->_cury = ly;
123*7c478bd9Sstevel@tonic-gate 			curscr->_curx = lx;
124*7c478bd9Sstevel@tonic-gate 			ly -= win->_begy;
125*7c478bd9Sstevel@tonic-gate 			lx -= win->_begx;
126*7c478bd9Sstevel@tonic-gate 			if (ly >= 0 && ly < win->_maxy && lx >= 0 &&
127*7c478bd9Sstevel@tonic-gate 			    lx < win->_maxx) {
128*7c478bd9Sstevel@tonic-gate 				win->_cury = ly;
129*7c478bd9Sstevel@tonic-gate 				win->_curx = lx;
130*7c478bd9Sstevel@tonic-gate 			}
131*7c478bd9Sstevel@tonic-gate 			else
132*7c478bd9Sstevel@tonic-gate 				win->_cury = win->_curx = 0;
133*7c478bd9Sstevel@tonic-gate 		} else {
134*7c478bd9Sstevel@tonic-gate 			domvcur(ly, lx, win->_cury + win->_begy,
135*7c478bd9Sstevel@tonic-gate 				win->_curx + win->_begx);
136*7c478bd9Sstevel@tonic-gate 			curscr->_cury = win->_cury + win->_begy;
137*7c478bd9Sstevel@tonic-gate 			curscr->_curx = win->_curx + win->_begx;
138*7c478bd9Sstevel@tonic-gate 		}
139*7c478bd9Sstevel@tonic-gate 	}
140*7c478bd9Sstevel@tonic-gate 	retval = OK;
141*7c478bd9Sstevel@tonic-gate 
142*7c478bd9Sstevel@tonic-gate 	_win = NULL;
143*7c478bd9Sstevel@tonic-gate 	(void) fflush(stdout);
144*7c478bd9Sstevel@tonic-gate 	return (retval);
145*7c478bd9Sstevel@tonic-gate }
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate /*
148*7c478bd9Sstevel@tonic-gate  * make a change on the screen
149*7c478bd9Sstevel@tonic-gate  */
150*7c478bd9Sstevel@tonic-gate 
151*7c478bd9Sstevel@tonic-gate DEBUGSTATIC int
makech(WINDOW * win,short wy)152*7c478bd9Sstevel@tonic-gate makech(WINDOW *win, short wy)
153*7c478bd9Sstevel@tonic-gate {
154*7c478bd9Sstevel@tonic-gate 	char	*nsp, *csp, *ce;
155*7c478bd9Sstevel@tonic-gate 	short	wx, lch, y;
156*7c478bd9Sstevel@tonic-gate 	intptr_t	nlsp, clsp;	/* last space in lines		*/
157*7c478bd9Sstevel@tonic-gate 
158*7c478bd9Sstevel@tonic-gate 	wx = win->_firstch[wy] - win->_ch_off;
159*7c478bd9Sstevel@tonic-gate 	if (wx >= win->_maxx)
160*7c478bd9Sstevel@tonic-gate 		return (OK);
161*7c478bd9Sstevel@tonic-gate 	else if (wx < 0)
162*7c478bd9Sstevel@tonic-gate 		wx = 0;
163*7c478bd9Sstevel@tonic-gate 	lch = win->_lastch[wy] - win->_ch_off;
164*7c478bd9Sstevel@tonic-gate 	if (lch < 0)
165*7c478bd9Sstevel@tonic-gate 		return (OK);
166*7c478bd9Sstevel@tonic-gate 	else if (lch >= win->_maxx)
167*7c478bd9Sstevel@tonic-gate 		lch = win->_maxx - 1;
168*7c478bd9Sstevel@tonic-gate 	y = wy + win->_begy;
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate 	if (curwin)
171*7c478bd9Sstevel@tonic-gate 		csp = " ";
172*7c478bd9Sstevel@tonic-gate 	else
173*7c478bd9Sstevel@tonic-gate 		csp = &curscr->_y[wy + win->_begy][wx + win->_begx];
174*7c478bd9Sstevel@tonic-gate 
175*7c478bd9Sstevel@tonic-gate 	nsp = &win->_y[wy][wx];
176*7c478bd9Sstevel@tonic-gate 	if (CE && !curwin) {
177*7c478bd9Sstevel@tonic-gate 		for (ce = &win->_y[wy][win->_maxx - 1]; *ce == ' '; ce--)
178*7c478bd9Sstevel@tonic-gate 			if (ce <= win->_y[wy])
179*7c478bd9Sstevel@tonic-gate 				break;
180*7c478bd9Sstevel@tonic-gate 		nlsp = ce - win->_y[wy];
181*7c478bd9Sstevel@tonic-gate 	}
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate 	if (!curwin)
184*7c478bd9Sstevel@tonic-gate 		ce = CE;
185*7c478bd9Sstevel@tonic-gate 	else
186*7c478bd9Sstevel@tonic-gate 		ce = NULL;
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate 	while (wx <= lch) {
189*7c478bd9Sstevel@tonic-gate 		if (*nsp != *csp) {
190*7c478bd9Sstevel@tonic-gate 			domvcur(ly, lx, y, wx + win->_begx);
191*7c478bd9Sstevel@tonic-gate #ifdef DEBUG
192*7c478bd9Sstevel@tonic-gate 			fprintf(outf, "MAKECH: 1: wx = %d, lx = %d\n", wx, lx);
193*7c478bd9Sstevel@tonic-gate #endif
194*7c478bd9Sstevel@tonic-gate 			ly = y;
195*7c478bd9Sstevel@tonic-gate 			lx = wx + win->_begx;
196*7c478bd9Sstevel@tonic-gate 			while (wx <= lch && *nsp != *csp) {
197*7c478bd9Sstevel@tonic-gate 				if (ce != NULL && wx >= nlsp && *nsp == ' ') {
198*7c478bd9Sstevel@tonic-gate 					/*
199*7c478bd9Sstevel@tonic-gate 					 * check for clear to end-of-line
200*7c478bd9Sstevel@tonic-gate 					 */
201*7c478bd9Sstevel@tonic-gate 					ce = &curscr->_y[ly][COLS - 1];
202*7c478bd9Sstevel@tonic-gate 					while (*ce == ' ')
203*7c478bd9Sstevel@tonic-gate 						if (ce-- <= csp)
204*7c478bd9Sstevel@tonic-gate 							break;
205*7c478bd9Sstevel@tonic-gate 					clsp = ce - curscr->_y[ly] - win->_begx;
206*7c478bd9Sstevel@tonic-gate #ifdef DEBUG
207*7c478bd9Sstevel@tonic-gate 					fprintf(outf, "MAKECH: clsp = %d,"
208*7c478bd9Sstevel@tonic-gate 					    " nlsp = %d\n", clsp, nlsp);
209*7c478bd9Sstevel@tonic-gate #endif
210*7c478bd9Sstevel@tonic-gate 					if (clsp - nlsp >= strlen(CE) &&
211*7c478bd9Sstevel@tonic-gate 					    clsp < win->_maxx) {
212*7c478bd9Sstevel@tonic-gate #ifdef DEBUG
213*7c478bd9Sstevel@tonic-gate 						fprintf(outf, "MAKECH: using"
214*7c478bd9Sstevel@tonic-gate 						    " CE\n");
215*7c478bd9Sstevel@tonic-gate #endif
216*7c478bd9Sstevel@tonic-gate 						(void) _puts(CE);
217*7c478bd9Sstevel@tonic-gate 						lx = wx + win->_begx;
218*7c478bd9Sstevel@tonic-gate 						while (wx++ <= clsp)
219*7c478bd9Sstevel@tonic-gate 							*csp++ = ' ';
220*7c478bd9Sstevel@tonic-gate 						return (OK);
221*7c478bd9Sstevel@tonic-gate 					}
222*7c478bd9Sstevel@tonic-gate 					ce = NULL;
223*7c478bd9Sstevel@tonic-gate 				}
224*7c478bd9Sstevel@tonic-gate 				/*
225*7c478bd9Sstevel@tonic-gate 				 * enter/exit standout mode as appropriate
226*7c478bd9Sstevel@tonic-gate 				 */
227*7c478bd9Sstevel@tonic-gate 				if (SO && (*nsp&_STANDOUT) !=
228*7c478bd9Sstevel@tonic-gate 				    (curscr->_flags&_STANDOUT)) {
229*7c478bd9Sstevel@tonic-gate 					if (*nsp & _STANDOUT) {
230*7c478bd9Sstevel@tonic-gate 						(void) _puts(SO);
231*7c478bd9Sstevel@tonic-gate 						curscr->_flags |= _STANDOUT;
232*7c478bd9Sstevel@tonic-gate 					} else {
233*7c478bd9Sstevel@tonic-gate 						(void) _puts(SE);
234*7c478bd9Sstevel@tonic-gate 						curscr->_flags &= ~_STANDOUT;
235*7c478bd9Sstevel@tonic-gate 					}
236*7c478bd9Sstevel@tonic-gate 				}
237*7c478bd9Sstevel@tonic-gate 				wx++;
238*7c478bd9Sstevel@tonic-gate 				if (wx >= win->_maxx && wy == win->_maxy - 1)
239*7c478bd9Sstevel@tonic-gate 					if (win->_scroll) {
240*7c478bd9Sstevel@tonic-gate 					    if ((curscr->_flags&_STANDOUT) &&
241*7c478bd9Sstevel@tonic-gate 						(win->_flags & _ENDLINE))
242*7c478bd9Sstevel@tonic-gate 						    if (!MS) {
243*7c478bd9Sstevel@tonic-gate 							(void) _puts(SE);
244*7c478bd9Sstevel@tonic-gate 							curscr->_flags &=
245*7c478bd9Sstevel@tonic-gate 							    ~_STANDOUT;
246*7c478bd9Sstevel@tonic-gate 						    }
247*7c478bd9Sstevel@tonic-gate 					    if (!curwin)
248*7c478bd9Sstevel@tonic-gate 						(void) _putchar((*csp = *nsp) &
249*7c478bd9Sstevel@tonic-gate 						    0177);
250*7c478bd9Sstevel@tonic-gate 					    else
251*7c478bd9Sstevel@tonic-gate 						(void) _putchar(*nsp & 0177);
252*7c478bd9Sstevel@tonic-gate 					    if (win->_flags&_FULLWIN && !curwin)
253*7c478bd9Sstevel@tonic-gate 						(void) scroll(curscr);
254*7c478bd9Sstevel@tonic-gate 					    if (!curwin) {
255*7c478bd9Sstevel@tonic-gate 						    ly = wy + win->_begy;
256*7c478bd9Sstevel@tonic-gate 						    lx = wx + win->_begx;
257*7c478bd9Sstevel@tonic-gate 					    } else {
258*7c478bd9Sstevel@tonic-gate 						    ly = win->_begy+win->_cury;
259*7c478bd9Sstevel@tonic-gate 						    lx = win->_begx+win->_curx;
260*7c478bd9Sstevel@tonic-gate 					    }
261*7c478bd9Sstevel@tonic-gate 					    return (OK);
262*7c478bd9Sstevel@tonic-gate 					} else if (win->_flags&_SCROLLWIN) {
263*7c478bd9Sstevel@tonic-gate 					    wx = wx - 1;
264*7c478bd9Sstevel@tonic-gate 					    lx = wx;
265*7c478bd9Sstevel@tonic-gate 					    return (ERR);
266*7c478bd9Sstevel@tonic-gate 					}
267*7c478bd9Sstevel@tonic-gate 				if (!curwin)
268*7c478bd9Sstevel@tonic-gate 					(void) _putchar((*csp++ = *nsp) & 0177);
269*7c478bd9Sstevel@tonic-gate 				else
270*7c478bd9Sstevel@tonic-gate 					(void) _putchar(*nsp & 0177);
271*7c478bd9Sstevel@tonic-gate #ifdef FULLDEBUG
272*7c478bd9Sstevel@tonic-gate 				fprintf(outf,
273*7c478bd9Sstevel@tonic-gate 					"MAKECH:putchar(%c)\n", *nsp & 0177);
274*7c478bd9Sstevel@tonic-gate #endif
275*7c478bd9Sstevel@tonic-gate 				if (UC && (*nsp & _STANDOUT)) {
276*7c478bd9Sstevel@tonic-gate 					(void) _putchar('\b');
277*7c478bd9Sstevel@tonic-gate 					(void) _puts(UC);
278*7c478bd9Sstevel@tonic-gate 				}
279*7c478bd9Sstevel@tonic-gate 				nsp++;
280*7c478bd9Sstevel@tonic-gate 			}
281*7c478bd9Sstevel@tonic-gate #ifdef DEBUG
282*7c478bd9Sstevel@tonic-gate 			fprintf(outf, "MAKECH: 2: wx = %d, lx = %d\n", wx, lx);
283*7c478bd9Sstevel@tonic-gate #endif
284*7c478bd9Sstevel@tonic-gate 			if (lx == wx + win->_begx)	/* if no change */
285*7c478bd9Sstevel@tonic-gate 				break;
286*7c478bd9Sstevel@tonic-gate 			lx = wx + win->_begx;
287*7c478bd9Sstevel@tonic-gate 			if (lx >= COLS && AM) {
288*7c478bd9Sstevel@tonic-gate 				lx = 0;
289*7c478bd9Sstevel@tonic-gate 				ly++;
290*7c478bd9Sstevel@tonic-gate 				/*
291*7c478bd9Sstevel@tonic-gate 				 * xn glitch: chomps a newline after auto-wrap.
292*7c478bd9Sstevel@tonic-gate 				 * we just feed it now and forget about it.
293*7c478bd9Sstevel@tonic-gate 				 */
294*7c478bd9Sstevel@tonic-gate 				if (XN) {
295*7c478bd9Sstevel@tonic-gate 					(void) _putchar('\n');
296*7c478bd9Sstevel@tonic-gate 					(void) _putchar('\r');
297*7c478bd9Sstevel@tonic-gate 				}
298*7c478bd9Sstevel@tonic-gate 			}
299*7c478bd9Sstevel@tonic-gate 		} else if (wx <= lch)
300*7c478bd9Sstevel@tonic-gate 			while (wx <= lch && *nsp == *csp) {
301*7c478bd9Sstevel@tonic-gate 				nsp++;
302*7c478bd9Sstevel@tonic-gate 				if (!curwin)
303*7c478bd9Sstevel@tonic-gate 					csp++;
304*7c478bd9Sstevel@tonic-gate 				++wx;
305*7c478bd9Sstevel@tonic-gate 			}
306*7c478bd9Sstevel@tonic-gate 		else
307*7c478bd9Sstevel@tonic-gate 			break;
308*7c478bd9Sstevel@tonic-gate #ifdef DEBUG
309*7c478bd9Sstevel@tonic-gate 		fprintf(outf, "MAKECH: 3: wx = %d, lx = %d\n", wx, lx);
310*7c478bd9Sstevel@tonic-gate #endif
311*7c478bd9Sstevel@tonic-gate 	}
312*7c478bd9Sstevel@tonic-gate 	return (OK);
313*7c478bd9Sstevel@tonic-gate }
314*7c478bd9Sstevel@tonic-gate 
315*7c478bd9Sstevel@tonic-gate /*
316*7c478bd9Sstevel@tonic-gate  * perform a mvcur, leaving standout mode if necessary
317*7c478bd9Sstevel@tonic-gate  */
318*7c478bd9Sstevel@tonic-gate 
319*7c478bd9Sstevel@tonic-gate DEBUGSTATIC void
domvcur(int oy,int ox,int ny,int nx)320*7c478bd9Sstevel@tonic-gate domvcur(int oy, int ox, int ny, int nx)
321*7c478bd9Sstevel@tonic-gate {
322*7c478bd9Sstevel@tonic-gate 	if (curscr->_flags & _STANDOUT && !MS) {
323*7c478bd9Sstevel@tonic-gate 		(void) _puts(SE);
324*7c478bd9Sstevel@tonic-gate 		curscr->_flags &= ~_STANDOUT;
325*7c478bd9Sstevel@tonic-gate 	}
326*7c478bd9Sstevel@tonic-gate 	(void) mvcur(oy, ox, ny, nx);
327*7c478bd9Sstevel@tonic-gate }
328