BSD 4 release
[unix-history] / usr / src / cmd / ex / ex_vops3.c
index b0e9697..57e3f2a 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (c) 1979 Regents of the University of California */
+/* Copyright (c) 1980 Regents of the University of California */
+static char *sccsid = "@(#)ex_vops3.c  6.2 10/23/80";
 #include "ex.h"
 #include "ex_tty.h"
 #include "ex_vis.h"
 #include "ex.h"
 #include "ex_tty.h"
 #include "ex_vis.h"
@@ -322,11 +323,11 @@ lmatchp(addr)
        register int i;
        register char *parens, *cp;
 
        register int i;
        register char *parens, *cp;
 
-       for (cp = cursor; !any(*cp, "({)}");)
+       for (cp = cursor; !any(*cp, "({[)}]");)
                if (*cp++ == 0)
                        return (0);
        lf = 0;
                if (*cp++ == 0)
                        return (0);
        lf = 0;
-       parens = any(*cp, "()") ? "()" : "{}";
+       parens = any(*cp, "()") ? "()" : any(*cp, "[]") ? "[]" : "{}";
        if (*cp == parens[1]) {
                dir = -1;
                llimit = one;
        if (*cp == parens[1]) {
                dir = -1;
                llimit = one;
@@ -370,6 +371,12 @@ lsmatch(cp)
                if (i)
                        goim();
        }
                if (i)
                        goim();
        }
+       else {
+               strcLIN(sp);
+               strcpy(scurs, genbuf);
+               if (!lmatchp((line *) 0))
+                       beep();
+       }
        strcLIN(sp);
        wdot = 0;
        wcursor = 0;
        strcLIN(sp);
        wdot = 0;
        wcursor = 0;
@@ -408,8 +415,10 @@ lskipbal(parens)
        register int c;
 
        do {
        register int c;
 
        do {
-               if (!lnext())
+               if (!lnext()) {
+                       wdot = NOLINE;
                        return (0);
                        return (0);
+               }
                c = *wcursor;
                if (c == parens[1])
                        level--;
                c = *wcursor;
                if (c == parens[1])
                        level--;
@@ -456,7 +465,7 @@ lnext()
                if (*wcursor)
                        return (1);
                if (wdot >= llimit) {
                if (*wcursor)
                        return (1);
                if (wdot >= llimit) {
-                       if (wcursor > linebuf)
+                       if (lf == vmove && wcursor > linebuf)
                                wcursor--;
                        return (0);
                }
                                wcursor--;
                        return (0);
                }