1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate *
4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate * with the License.
8*7c478bd9Sstevel@tonic-gate *
9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate *
14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate *
20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate */
26*7c478bd9Sstevel@tonic-gate
27*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */
28*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */
29*7c478bd9Sstevel@tonic-gate
30*7c478bd9Sstevel@tonic-gate /*
31*7c478bd9Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988
32*7c478bd9Sstevel@tonic-gate * The Regents of the University of California
33*7c478bd9Sstevel@tonic-gate * All Rights Reserved
34*7c478bd9Sstevel@tonic-gate *
35*7c478bd9Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from
36*7c478bd9Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its
37*7c478bd9Sstevel@tonic-gate * contributors.
38*7c478bd9Sstevel@tonic-gate */
39*7c478bd9Sstevel@tonic-gate
40*7c478bd9Sstevel@tonic-gate /*LINTLIBRARY*/
41*7c478bd9Sstevel@tonic-gate
42*7c478bd9Sstevel@tonic-gate #include <stdlib.h>
43*7c478bd9Sstevel@tonic-gate #include "curses_inc.h"
44*7c478bd9Sstevel@tonic-gate
45*7c478bd9Sstevel@tonic-gate
46*7c478bd9Sstevel@tonic-gate /* Functions to make use of insert/delete line caps */
47*7c478bd9Sstevel@tonic-gate
48*7c478bd9Sstevel@tonic-gate #define scrco COLS
49*7c478bd9Sstevel@tonic-gate
50*7c478bd9Sstevel@tonic-gate typedef struct
51*7c478bd9Sstevel@tonic-gate {
52*7c478bd9Sstevel@tonic-gate int _wy, /* matching lines */
53*7c478bd9Sstevel@tonic-gate _sy;
54*7c478bd9Sstevel@tonic-gate } IDST;
55*7c478bd9Sstevel@tonic-gate static IDST *sid, *eid; /* list of idln actions */
56*7c478bd9Sstevel@tonic-gate static int scrli, /* screen dimensions */
57*7c478bd9Sstevel@tonic-gate cy, cx; /* current cursor positions */
58*7c478bd9Sstevel@tonic-gate static bool didcsr; /* scrolling region was used */
59*7c478bd9Sstevel@tonic-gate static int _use_idln(void), _set_idln(void);
60*7c478bd9Sstevel@tonic-gate static void _do_idln(int, int, int, int);
61*7c478bd9Sstevel@tonic-gate
62*7c478bd9Sstevel@tonic-gate /* Set insert/delete line mode for win */
63*7c478bd9Sstevel@tonic-gate
64*7c478bd9Sstevel@tonic-gate int
idlok(WINDOW * win,bool bf)65*7c478bd9Sstevel@tonic-gate idlok(WINDOW *win, bool bf)
66*7c478bd9Sstevel@tonic-gate {
67*7c478bd9Sstevel@tonic-gate _useidln = _use_idln;
68*7c478bd9Sstevel@tonic-gate _setidln = _set_idln;
69*7c478bd9Sstevel@tonic-gate
70*7c478bd9Sstevel@tonic-gate SP->yesidln = (delete_line || parm_delete_line ||
71*7c478bd9Sstevel@tonic-gate (change_scroll_region && (parm_index || scroll_forward))) &&
72*7c478bd9Sstevel@tonic-gate (insert_line || parm_insert_line ||
73*7c478bd9Sstevel@tonic-gate (change_scroll_region && (parm_rindex || scroll_reverse)));
74*7c478bd9Sstevel@tonic-gate
75*7c478bd9Sstevel@tonic-gate win->_use_idl = bf;
76*7c478bd9Sstevel@tonic-gate return (OK);
77*7c478bd9Sstevel@tonic-gate }
78*7c478bd9Sstevel@tonic-gate
79*7c478bd9Sstevel@tonic-gate /*
80*7c478bd9Sstevel@tonic-gate * Set the places to do insert/delete lines
81*7c478bd9Sstevel@tonic-gate * Return the start line for such action.
82*7c478bd9Sstevel@tonic-gate */
83*7c478bd9Sstevel@tonic-gate
84*7c478bd9Sstevel@tonic-gate static int
_set_idln(void)85*7c478bd9Sstevel@tonic-gate _set_idln(void)
86*7c478bd9Sstevel@tonic-gate {
87*7c478bd9Sstevel@tonic-gate /*
88*7c478bd9Sstevel@tonic-gate * The value we want to return is the lower line
89*7c478bd9Sstevel@tonic-gate * number of the top-most range.
90*7c478bd9Sstevel@tonic-gate *
91*7c478bd9Sstevel@tonic-gate * If there is more than one range of lines on which
92*7c478bd9Sstevel@tonic-gate * we're operating, _find_idln will get called more
93*7c478bd9Sstevel@tonic-gate * then once; we need to search all the IDST for the
94*7c478bd9Sstevel@tonic-gate * desired return value.
95*7c478bd9Sstevel@tonic-gate */
96*7c478bd9Sstevel@tonic-gate {
97*7c478bd9Sstevel@tonic-gate IDST *idp;
98*7c478bd9Sstevel@tonic-gate int rval = scrli;
99*7c478bd9Sstevel@tonic-gate
100*7c478bd9Sstevel@tonic-gate for (idp = sid; idp != eid; idp++) {
101*7c478bd9Sstevel@tonic-gate int tmp;
102*7c478bd9Sstevel@tonic-gate
103*7c478bd9Sstevel@tonic-gate if ((tmp = _MIN(idp->_wy, idp->_sy)) < rval)
104*7c478bd9Sstevel@tonic-gate rval = tmp;
105*7c478bd9Sstevel@tonic-gate }
106*7c478bd9Sstevel@tonic-gate return (rval);
107*7c478bd9Sstevel@tonic-gate }
108*7c478bd9Sstevel@tonic-gate }
109*7c478bd9Sstevel@tonic-gate
110*7c478bd9Sstevel@tonic-gate /* Use hardware line delete/insert */
111*7c478bd9Sstevel@tonic-gate
112*7c478bd9Sstevel@tonic-gate static int
_use_idln(void)113*7c478bd9Sstevel@tonic-gate _use_idln(void)
114*7c478bd9Sstevel@tonic-gate {
115*7c478bd9Sstevel@tonic-gate int tsy, bsy, idn, dir, nomore;
116*7c478bd9Sstevel@tonic-gate IDST *ip, *ep, *eip;
117*7c478bd9Sstevel@tonic-gate
118*7c478bd9Sstevel@tonic-gate cy = curscr->_cury;
119*7c478bd9Sstevel@tonic-gate cx = curscr->_curx;
120*7c478bd9Sstevel@tonic-gate didcsr = FALSE;
121*7c478bd9Sstevel@tonic-gate
122*7c478bd9Sstevel@tonic-gate /* first cycle do deletions, second cycle do insertions */
123*7c478bd9Sstevel@tonic-gate for (dir = 1; dir > -2; dir -= 2) {
124*7c478bd9Sstevel@tonic-gate if (dir > 0) {
125*7c478bd9Sstevel@tonic-gate ip = sid;
126*7c478bd9Sstevel@tonic-gate eip = eid;
127*7c478bd9Sstevel@tonic-gate } else {
128*7c478bd9Sstevel@tonic-gate ip = eid - 1;
129*7c478bd9Sstevel@tonic-gate eip = sid - 1;
130*7c478bd9Sstevel@tonic-gate }
131*7c478bd9Sstevel@tonic-gate
132*7c478bd9Sstevel@tonic-gate nomore = TRUE;
133*7c478bd9Sstevel@tonic-gate while (ip != eip) {
134*7c478bd9Sstevel@tonic-gate /* skip deletions or insertions */
135*7c478bd9Sstevel@tonic-gate if ((dir > 0 && ip->_wy > ip->_sy) ||
136*7c478bd9Sstevel@tonic-gate (dir < 0 && ip->_wy < ip->_sy)) {
137*7c478bd9Sstevel@tonic-gate nomore = FALSE;
138*7c478bd9Sstevel@tonic-gate ip += dir;
139*7c478bd9Sstevel@tonic-gate continue;
140*7c478bd9Sstevel@tonic-gate }
141*7c478bd9Sstevel@tonic-gate
142*7c478bd9Sstevel@tonic-gate /* find a contiguous block */
143*7c478bd9Sstevel@tonic-gate for (ep = ip+dir; ep != eip; ep += dir)
144*7c478bd9Sstevel@tonic-gate if (ep->_wy != (ep - dir)->_wy + dir ||
145*7c478bd9Sstevel@tonic-gate ep->_sy != (ep - dir)->_sy + dir) {
146*7c478bd9Sstevel@tonic-gate break;
147*7c478bd9Sstevel@tonic-gate }
148*7c478bd9Sstevel@tonic-gate ep -= dir;
149*7c478bd9Sstevel@tonic-gate
150*7c478bd9Sstevel@tonic-gate /* top and bottom lines of the affected region */
151*7c478bd9Sstevel@tonic-gate if (dir > 0) {
152*7c478bd9Sstevel@tonic-gate tsy = _MIN(ip->_wy, ip->_sy);
153*7c478bd9Sstevel@tonic-gate bsy = _MAX(ep->_wy, ep->_sy) + 1;
154*7c478bd9Sstevel@tonic-gate } else {
155*7c478bd9Sstevel@tonic-gate tsy = _MIN(ep->_wy, ep->_sy);
156*7c478bd9Sstevel@tonic-gate bsy = _MAX(ip->_wy, ip->_sy) + 1;
157*7c478bd9Sstevel@tonic-gate }
158*7c478bd9Sstevel@tonic-gate
159*7c478bd9Sstevel@tonic-gate /* amount to insert/delete */
160*7c478bd9Sstevel@tonic-gate if ((idn = ip->_wy - ip->_sy) < 0)
161*7c478bd9Sstevel@tonic-gate idn = -idn;
162*7c478bd9Sstevel@tonic-gate
163*7c478bd9Sstevel@tonic-gate /* do the actual output */
164*7c478bd9Sstevel@tonic-gate _do_idln(tsy, bsy, idn, dir == -1);
165*7c478bd9Sstevel@tonic-gate
166*7c478bd9Sstevel@tonic-gate /* update change structure */
167*7c478bd9Sstevel@tonic-gate (void) wtouchln(_virtscr, tsy, bsy - tsy, -1);
168*7c478bd9Sstevel@tonic-gate
169*7c478bd9Sstevel@tonic-gate /* update screen image */
170*7c478bd9Sstevel@tonic-gate /*LINTED*/
171*7c478bd9Sstevel@tonic-gate curscr->_tmarg = (short)tsy;
172*7c478bd9Sstevel@tonic-gate curscr->_bmarg = bsy - 1;
173*7c478bd9Sstevel@tonic-gate /*LINTED*/
174*7c478bd9Sstevel@tonic-gate curscr->_cury = (short)tsy;
175*7c478bd9Sstevel@tonic-gate (void) winsdelln(curscr, dir > 0 ? -idn : idn);
176*7c478bd9Sstevel@tonic-gate curscr->_tmarg = 0;
177*7c478bd9Sstevel@tonic-gate curscr->_bmarg = scrli - 1;
178*7c478bd9Sstevel@tonic-gate
179*7c478bd9Sstevel@tonic-gate /* for next while cycle */
180*7c478bd9Sstevel@tonic-gate ip = ep + dir;
181*7c478bd9Sstevel@tonic-gate }
182*7c478bd9Sstevel@tonic-gate
183*7c478bd9Sstevel@tonic-gate if (nomore)
184*7c478bd9Sstevel@tonic-gate break;
185*7c478bd9Sstevel@tonic-gate }
186*7c478bd9Sstevel@tonic-gate
187*7c478bd9Sstevel@tonic-gate /* reset scrolling region */
188*7c478bd9Sstevel@tonic-gate if (didcsr) {
189*7c478bd9Sstevel@tonic-gate _PUTS(tparm_p2(change_scroll_region, 0, scrli - 1), scrli);
190*7c478bd9Sstevel@tonic-gate cy = cx = -1;
191*7c478bd9Sstevel@tonic-gate }
192*7c478bd9Sstevel@tonic-gate
193*7c478bd9Sstevel@tonic-gate /*LINTED*/
194*7c478bd9Sstevel@tonic-gate curscr->_cury = (short)cy;
195*7c478bd9Sstevel@tonic-gate /*LINTED*/
196*7c478bd9Sstevel@tonic-gate curscr->_curx = (short)cx;
197*7c478bd9Sstevel@tonic-gate return (OK);
198*7c478bd9Sstevel@tonic-gate }
199*7c478bd9Sstevel@tonic-gate
200*7c478bd9Sstevel@tonic-gate /* Do the actual insert/delete lines */
201*7c478bd9Sstevel@tonic-gate
202*7c478bd9Sstevel@tonic-gate static void
_do_idln(int tsy,int bsy,int idn,int doinsert)203*7c478bd9Sstevel@tonic-gate _do_idln(int tsy, int bsy, int idn, int doinsert)
204*7c478bd9Sstevel@tonic-gate {
205*7c478bd9Sstevel@tonic-gate int y, usecsr, yesscrl;
206*7c478bd9Sstevel@tonic-gate short *begns;
207*7c478bd9Sstevel@tonic-gate
208*7c478bd9Sstevel@tonic-gate /* change scrolling region */
209*7c478bd9Sstevel@tonic-gate yesscrl = usecsr = FALSE;
210*7c478bd9Sstevel@tonic-gate if (tsy > 0 || bsy < scrli) {
211*7c478bd9Sstevel@tonic-gate if (change_scroll_region) {
212*7c478bd9Sstevel@tonic-gate _PUTS(tparm_p2(change_scroll_region, tsy, bsy - 1),
213*7c478bd9Sstevel@tonic-gate bsy - tsy);
214*7c478bd9Sstevel@tonic-gate cy = cx = -1;
215*7c478bd9Sstevel@tonic-gate yesscrl = usecsr = didcsr = TRUE;
216*7c478bd9Sstevel@tonic-gate }
217*7c478bd9Sstevel@tonic-gate } else {
218*7c478bd9Sstevel@tonic-gate if (didcsr) {
219*7c478bd9Sstevel@tonic-gate _PUTS(tparm_p2(change_scroll_region, 0, scrli - 1), scrli);
220*7c478bd9Sstevel@tonic-gate cy = cx = -1;
221*7c478bd9Sstevel@tonic-gate didcsr = FALSE;
222*7c478bd9Sstevel@tonic-gate }
223*7c478bd9Sstevel@tonic-gate yesscrl = TRUE;
224*7c478bd9Sstevel@tonic-gate }
225*7c478bd9Sstevel@tonic-gate
226*7c478bd9Sstevel@tonic-gate if (doinsert) {
227*7c478bd9Sstevel@tonic-gate /* memory below, clobber it now */
228*7c478bd9Sstevel@tonic-gate if (memory_below && clr_eol &&
229*7c478bd9Sstevel@tonic-gate ((usecsr && non_dest_scroll_region) || bsy == scrli)) {
230*7c478bd9Sstevel@tonic-gate for (y = bsy - idn, begns = _BEGNS + y;
231*7c478bd9Sstevel@tonic-gate y < bsy; ++y, ++begns)
232*7c478bd9Sstevel@tonic-gate if (*begns < scrco) {
233*7c478bd9Sstevel@tonic-gate (void) mvcur(cy, cx, y, 0);
234*7c478bd9Sstevel@tonic-gate cy = y;
235*7c478bd9Sstevel@tonic-gate cx = 0;
236*7c478bd9Sstevel@tonic-gate _PUTS(clr_eol, 1);
237*7c478bd9Sstevel@tonic-gate }
238*7c478bd9Sstevel@tonic-gate }
239*7c478bd9Sstevel@tonic-gate
240*7c478bd9Sstevel@tonic-gate /* if not change_scroll_region, delete, then insert */
241*7c478bd9Sstevel@tonic-gate if (!usecsr && bsy < scrli) {
242*7c478bd9Sstevel@tonic-gate /* delete appropriate number of lines */
243*7c478bd9Sstevel@tonic-gate (void) mvcur(cy, cx, bsy - idn, 0);
244*7c478bd9Sstevel@tonic-gate cy = bsy - idn;
245*7c478bd9Sstevel@tonic-gate cx = 0;
246*7c478bd9Sstevel@tonic-gate if (parm_delete_line && (idn > 1 || !delete_line))
247*7c478bd9Sstevel@tonic-gate _PUTS(tparm_p1(parm_delete_line, idn),
248*7c478bd9Sstevel@tonic-gate scrli - cy);
249*7c478bd9Sstevel@tonic-gate else
250*7c478bd9Sstevel@tonic-gate for (y = 0; y < idn; ++y)
251*7c478bd9Sstevel@tonic-gate _PUTS(delete_line, scrli - cy);
252*7c478bd9Sstevel@tonic-gate }
253*7c478bd9Sstevel@tonic-gate
254*7c478bd9Sstevel@tonic-gate /* now do insert */
255*7c478bd9Sstevel@tonic-gate (void) mvcur(cy, cx, tsy, 0);
256*7c478bd9Sstevel@tonic-gate cy = tsy;
257*7c478bd9Sstevel@tonic-gate cx = 0;
258*7c478bd9Sstevel@tonic-gate if (yesscrl) {
259*7c478bd9Sstevel@tonic-gate if (!parm_rindex && (!scroll_reverse ||
260*7c478bd9Sstevel@tonic-gate (parm_insert_line && idn > 1))) {
261*7c478bd9Sstevel@tonic-gate goto hardinsert;
262*7c478bd9Sstevel@tonic-gate }
263*7c478bd9Sstevel@tonic-gate if (parm_rindex && (idn > 1 || !scroll_reverse))
264*7c478bd9Sstevel@tonic-gate _PUTS(tparm_p1(parm_rindex, idn), scrli - cy);
265*7c478bd9Sstevel@tonic-gate else
266*7c478bd9Sstevel@tonic-gate for (y = 0; y < idn; ++y)
267*7c478bd9Sstevel@tonic-gate _PUTS(scroll_reverse, scrli - cy);
268*7c478bd9Sstevel@tonic-gate } else {
269*7c478bd9Sstevel@tonic-gate hardinsert:
270*7c478bd9Sstevel@tonic-gate if (parm_insert_line && (idn > 1 || !insert_line))
271*7c478bd9Sstevel@tonic-gate _PUTS(tparm_p1(parm_insert_line, idn),
272*7c478bd9Sstevel@tonic-gate scrli - cy);
273*7c478bd9Sstevel@tonic-gate else
274*7c478bd9Sstevel@tonic-gate for (y = 0; y < idn; ++y)
275*7c478bd9Sstevel@tonic-gate _PUTS(insert_line, scrli - cy);
276*7c478bd9Sstevel@tonic-gate }
277*7c478bd9Sstevel@tonic-gate } else {
278*7c478bd9Sstevel@tonic-gate /* doing deletion */
279*7c478bd9Sstevel@tonic-gate /* memory above, clobber it now */
280*7c478bd9Sstevel@tonic-gate if (memory_above && clr_eol &&
281*7c478bd9Sstevel@tonic-gate ((usecsr && non_dest_scroll_region) || tsy == 0)) {
282*7c478bd9Sstevel@tonic-gate for (y = 0, begns = _BEGNS + y + tsy;
283*7c478bd9Sstevel@tonic-gate y < idn; ++y, ++begns)
284*7c478bd9Sstevel@tonic-gate if (*begns < scrco) {
285*7c478bd9Sstevel@tonic-gate (void) mvcur(cy, cx, tsy + y, 0);
286*7c478bd9Sstevel@tonic-gate cy = tsy + y;
287*7c478bd9Sstevel@tonic-gate cx = 0;
288*7c478bd9Sstevel@tonic-gate _PUTS(clr_eol, 1);
289*7c478bd9Sstevel@tonic-gate }
290*7c478bd9Sstevel@tonic-gate }
291*7c478bd9Sstevel@tonic-gate
292*7c478bd9Sstevel@tonic-gate if (yesscrl) {
293*7c478bd9Sstevel@tonic-gate if (!parm_index && (!scroll_forward ||
294*7c478bd9Sstevel@tonic-gate (parm_delete_line && idn > 1))) {
295*7c478bd9Sstevel@tonic-gate goto harddelete;
296*7c478bd9Sstevel@tonic-gate }
297*7c478bd9Sstevel@tonic-gate (void) mvcur(cy, cx, bsy - 1, 0);
298*7c478bd9Sstevel@tonic-gate cy = bsy - 1;
299*7c478bd9Sstevel@tonic-gate cx = 0;
300*7c478bd9Sstevel@tonic-gate if (parm_index && (idn > 1 || !scroll_forward))
301*7c478bd9Sstevel@tonic-gate _PUTS(tparm_p1(parm_index, idn), scrli - cy);
302*7c478bd9Sstevel@tonic-gate else
303*7c478bd9Sstevel@tonic-gate for (y = 0; y < idn; ++y)
304*7c478bd9Sstevel@tonic-gate _PUTS(scroll_forward, scrli - cy);
305*7c478bd9Sstevel@tonic-gate } else {
306*7c478bd9Sstevel@tonic-gate harddelete:
307*7c478bd9Sstevel@tonic-gate /* do deletion */
308*7c478bd9Sstevel@tonic-gate (void) mvcur(cy, cx, tsy, 0);
309*7c478bd9Sstevel@tonic-gate cy = tsy;
310*7c478bd9Sstevel@tonic-gate cx = 0;
311*7c478bd9Sstevel@tonic-gate if (parm_delete_line && (idn > 1 || !delete_line))
312*7c478bd9Sstevel@tonic-gate _PUTS(tparm_p1(parm_delete_line, idn),
313*7c478bd9Sstevel@tonic-gate scrli - cy);
314*7c478bd9Sstevel@tonic-gate else
315*7c478bd9Sstevel@tonic-gate for (y = 0; y < idn; ++y)
316*7c478bd9Sstevel@tonic-gate _PUTS(delete_line, scrli - cy);
317*7c478bd9Sstevel@tonic-gate }
318*7c478bd9Sstevel@tonic-gate
319*7c478bd9Sstevel@tonic-gate /* if not change_scroll_region, do insert to restore bottom */
320*7c478bd9Sstevel@tonic-gate if (!usecsr && bsy < scrli) {
321*7c478bd9Sstevel@tonic-gate y = scrli - 1;
322*7c478bd9Sstevel@tonic-gate begns = _BEGNS + y;
323*7c478bd9Sstevel@tonic-gate for (; y >= bsy; --y, --begns)
324*7c478bd9Sstevel@tonic-gate if (*begns < scrco)
325*7c478bd9Sstevel@tonic-gate break;
326*7c478bd9Sstevel@tonic-gate if (y >= bsy) {
327*7c478bd9Sstevel@tonic-gate (void) mvcur(cy, cx, bsy - idn, 0);
328*7c478bd9Sstevel@tonic-gate cy = bsy - idn;
329*7c478bd9Sstevel@tonic-gate cx = 0;
330*7c478bd9Sstevel@tonic-gate if (parm_insert_line &&
331*7c478bd9Sstevel@tonic-gate (idn > 1 || !insert_line))
332*7c478bd9Sstevel@tonic-gate _PUTS(tparm_p1(parm_insert_line, idn),
333*7c478bd9Sstevel@tonic-gate scrli - cy);
334*7c478bd9Sstevel@tonic-gate else
335*7c478bd9Sstevel@tonic-gate for (y = 0; y < idn; ++y)
336*7c478bd9Sstevel@tonic-gate _PUTS(insert_line, scrli - cy);
337*7c478bd9Sstevel@tonic-gate }
338*7c478bd9Sstevel@tonic-gate }
339*7c478bd9Sstevel@tonic-gate }
340*7c478bd9Sstevel@tonic-gate }
341