changed the way the INDEX operator is evaluated to better
[unix-history] / usr / src / usr.bin / ex / ex_voper.c
index 3c2949d..a8db3bd 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (c) 1980 Regents of the University of California */
-static char *sccsid = "@(#)ex_voper.c  4.2 %G%";
+/* Copyright (c) 1981 Regents of the University of California */
+static char *sccsid = "@(#)ex_voper.c  7.2     %G%";
 #include "ex.h"
 #include "ex_tty.h"
 #include "ex_vis.h"
 #include "ex.h"
 #include "ex_tty.h"
 #include "ex_vis.h"
@@ -30,7 +30,7 @@ operate(c, cnt)
        register line *addr;
        line *odot;
        static char lastFKND, lastFCHR;
        register line *addr;
        line *odot;
        static char lastFKND, lastFCHR;
-       char d;
+       short d;
 
        moveop = vmove, deleteop = vdelete;
        wcursor = cursor;
 
        moveop = vmove, deleteop = vdelete;
        wcursor = cursor;
@@ -106,8 +106,8 @@ operate(c, cnt)
         *              character.
         */
        case 'r':
         *              character.
         */
        case 'r':
-               vrep(cnt);
                vmacchng(1);
                vmacchng(1);
+               vrep(cnt);
                return;
 
        default:
                return;
 
        default:
@@ -215,6 +215,10 @@ ein:
        case '%':
                vsave();
                i = lmatchp((line *) 0);
        case '%':
                vsave();
                i = lmatchp((line *) 0);
+#ifdef TRACE
+               if (trace)
+                       fprintf(trace, "after lmatchp in %, dot=%d, wdot=%d, dol=%d\n", lineno(dot), lineno(wdot), lineno(dol));
+#endif
                getDOT();
                forbid(!i);
                if (opf != vmove)
                getDOT();
                forbid(!i);
                if (opf != vmove)
@@ -245,8 +249,7 @@ ein:
        case ']':
                if (!vglobp)
                        forbid(getkey() != c);
        case ']':
                if (!vglobp)
                        forbid(getkey() != c);
-               if (Xhadcnt)
-                       vsetsiz(Xcnt);
+               forbid (Xhadcnt);
                vsave();
                i = lbrack(c, opf);
                getDOT();
                vsave();
                i = lbrack(c, opf);
                getDOT();
@@ -561,8 +564,7 @@ errlab:
                forbid (c == 0);
                wdot = getmark(c);
                forbid (wdot == NOLINE);
                forbid (c == 0);
                wdot = getmark(c);
                forbid (wdot == NOLINE);
-               if (Xhadcnt)
-                       vsetsiz(Xcnt);
+               forbid (Xhadcnt);
                vmoving = 0;
                wcursor = d == '`' ? ncols[c - 'a'] : 0;
                if (opf == vmove && (wdot != dot || (d == '`' && wcursor != cursor)))
                vmoving = 0;
                wcursor = d == '`' ? ncols[c - 'a'] : 0;
                if (opf == vmove && (wdot != dot || (d == '`' && wcursor != cursor)))
@@ -599,8 +601,7 @@ errlab:
         */
        case '/':
        case '?':
         */
        case '/':
        case '?':
-               if (Xhadcnt)
-                       vsetsiz(Xcnt);
+               forbid (Xhadcnt);
                vsave();
                ocurs = cursor;
                odot = dot;
                vsave();
                ocurs = cursor;
                odot = dot;