Sun version and make install fixes
[unix-history] / usr / src / usr.bin / ex / ex_vadj.c
index 599a26e..58edaba 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (c) 1980 Regents of the University of California */
-static char *sccsid = "@(#)ex_vadj.c   6.1 %G%";
+/* Copyright (c) 1981 Regents of the University of California */
+static char *sccsid = "@(#)ex_vadj.c   7.6     %G%";
 #include "ex.h"
 #include "ex_tty.h"
 #include "ex_vis.h"
 #include "ex.h"
 #include "ex_tty.h"
 #include "ex_vis.h"
@@ -89,10 +89,6 @@ vreopen(p, lineno, l)
        register int d;
        register struct vlinfo *vp = &vlinfo[l];
 
        register int d;
        register struct vlinfo *vp = &vlinfo[l];
 
-#ifdef ADEBUG
-       if (trace)
-               tfixnl(), fprintf(trace, "vreopen(%d, %d, %d)\n", p, lineno, l);
-#endif
        d = vp->vdepth;
        if (d == 0 || (vp->vflags & VDIRT))
                vp->vdepth = d = vdepth();
        d = vp->vdepth;
        if (d == 0 || (vp->vflags & VDIRT))
                vp->vdepth = d = vdepth();
@@ -116,15 +112,7 @@ vreopen(p, lineno, l)
         *              necessary to determine which way to go.
         */
        vigoto(p, 0);
         *              necessary to determine which way to go.
         */
        vigoto(p, 0);
-#ifdef TRACE
-       if (trace)
-               fprintf(trace, "before pline in vreopen\n");
-#endif
        pline(lineno);
        pline(lineno);
-#ifdef TRACE
-       if (trace)
-               fprintf(trace, "after pline in vreopen\n");
-#endif
 
        /*
         * When we are typing part of a line for hardcopy open, don't
 
        /*
         * When we are typing part of a line for hardcopy open, don't
@@ -267,11 +255,29 @@ vinslin(p, cnt, l)
                /*
                 * Use insert line.
                 */
                /*
                 * Use insert line.
                 */
-               vgoto(p, 0), vputp(AL, WECHO + 1 - p);
-               for (i = cnt - 1; i > 0; i--) {
-                       vgoto(outline+1, 0), vputp(AL, WECHO + 1 - outline);
-                       if ((hold & HOLDAT) == 0)
-                               putchar('@');
+               vgoto(p, 0);
+               if (AL_PARM && (cnt>1 || *AL==0)) {
+                       /* insert cnt lines.  Should do @'s too. */
+                       vputp(tgoto(AL_PARM, p, cnt), WECHO+1-p);
+               }
+               else if (CS && *AL==0) {
+                       /* vt100 change scrolling region to fake AL */
+                       vputp(SC, 1);
+                       vputp(tgoto(CS, LINES-1,p), 1);
+                       vputp(RC, 1);   /* CS homes stupid cursor */
+                       for (i=cnt; i>0; i--)
+                               vputp(SR, 1);   /* should do @'s */
+                       vputp(tgoto(CS, LINES-1,0), 1);
+                       vputp(RC, 1);   /* Once again put it back */
+               }
+               else {
+                       vputp(AL, WECHO + 1 - p);
+                       for (i = cnt - 1; i > 0; i--) {
+                               vgoto(outline+1, 0);
+                               vputp(AL, WECHO + 1 - outline);
+                               if ((hold & HOLDAT) == 0)
+                                       putchar('@');
+                       }
                }
                vadjAL(p, cnt);
        } else
                }
                vadjAL(p, cnt);
        } else
@@ -402,6 +408,9 @@ vmoveitup(cnt, doclr)
        if (doclr && (SO || SE))
                vclrech(0);
        if (SF) {
        if (doclr && (SO || SE))
                vclrech(0);
        if (SF) {
+               destline = WECHO;
+               destcol = (NONL ? 0 : outcol % WCOLS);
+               fgoto();
                while (cnt > 0)
                        vputp(SF, 0), cnt--;
                return;
                while (cnt > 0)
                        vputp(SF, 0), cnt--;
                return;
@@ -730,8 +739,23 @@ vdellin(p, cnt, l)
         * and physical internal data structures.
         */
        vgoto(p, 0);
         * and physical internal data structures.
         */
        vgoto(p, 0);
-       for (i = 0; i < cnt; i++)
-               vputp(DL, WECHO - p);
+       if (DL_PARM && (cnt>1 || *DL==0)) {
+               vputp(tgoto(DL_PARM, p, cnt), WECHO-p);
+       }
+       else if (CS && *DL==0) {
+               /* vt100: fake DL by changing scrolling region */
+               vputp(SC, 1);   /* Save since CS homes stupid cursor */
+               vputp(tgoto(CS, LINES-1, p), 1);
+               vputp(tgoto(CM, 0, 23), 1);     /* Go to lower left corner */
+               for (i=0; i<cnt; i++)           /* .. and scroll cnt times */
+                       putch('\n');            /* should check NL too */
+               vputp(tgoto(CS, LINES-1, 0), 1);/* restore scrolling region */
+               vputp(RC, 1);                   /* put cursor back */
+       }
+       else {
+               for (i = 0; i < cnt; i++)
+                       vputp(DL, WECHO - p);
+       }
        vadjDL(p, cnt);
        vcloseup(l, cnt);
 }
        vadjDL(p, cnt);
        vcloseup(l, cnt);
 }