document distributed with 4.1BSD
[unix-history] / usr / src / usr.bin / ex / ex_voper.c
index 42812bf..725b474 100644 (file)
@@ -1,4 +1,13 @@
-/* Copyright (c) 1979 Regents of the University of California */
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char *sccsid = "@(#)ex_voper.c  7.4 (Berkeley) %G%";
+#endif not lint
+
 #include "ex.h"
 #include "ex_tty.h"
 #include "ex_vis.h"
 #include "ex.h"
 #include "ex_tty.h"
 #include "ex_vis.h"
@@ -29,7 +38,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;
@@ -105,12 +114,14 @@ operate(c, cnt)
         *              character.
         */
        case 'r':
         *              character.
         */
        case 'r':
+               vmacchng(1);
                vrep(cnt);
                return;
 
        default:
                goto nocount;
        }
                vrep(cnt);
                return;
 
        default:
                goto nocount;
        }
+       vmacchng(1);
        /*
         * Had an operator, so accept another count.
         * Multiply counts together.
        /*
         * Had an operator, so accept another count.
         * Multiply counts together.
@@ -212,6 +223,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)
@@ -242,8 +257,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();
@@ -413,6 +427,7 @@ deleteit:
        case 'x':
                if (margin())
                        goto errlab;
        case 'x':
                if (margin())
                        goto errlab;
+               vmacchng(1);
                while (cnt > 0 && !margin())
                        wcursor += dir, cnt--;
                opf = deleteop;
                while (cnt > 0 && !margin())
                        wcursor += dir, cnt--;
                opf = deleteop;
@@ -557,8 +572,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)))
@@ -595,8 +609,7 @@ errlab:
         */
        case '/':
        case '?':
         */
        case '/':
        case '?':
-               if (Xhadcnt)
-                       vsetsiz(Xcnt);
+               forbid (Xhadcnt);
                vsave();
                ocurs = cursor;
                odot = dot;
                vsave();
                ocurs = cursor;
                odot = dot;