]> granicus.if.org Git - vim/commitdiff
updated for version 7.1-162 v7.1.162
authorBram Moolenaar <Bram@vim.org>
Sat, 24 Nov 2007 20:50:24 +0000 (20:50 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 24 Nov 2007 20:50:24 +0000 (20:50 +0000)
src/ex_docmd.c
src/ex_eval.c
src/proto/ex_docmd.pro
src/version.c

index a6186f4db9f0f76e24c1b9760b723a40249dc87d..140fdca3d4e4df679c664e67edc2ae86b99c38ec 100644 (file)
@@ -2963,6 +2963,57 @@ find_ucmd(eap, p, full, xp, compl)
 #endif
 
 #if defined(FEAT_EVAL) || defined(PROTO)
+static struct cmdmod
+{
+    char       *name;
+    int                minlen;
+    int                has_count;  /* :123verbose  :3tab */
+} cmdmods[] = {
+    {"aboveleft", 3, FALSE},
+    {"belowright", 3, FALSE},
+    {"botright", 2, FALSE},
+    {"browse", 3, FALSE},
+    {"confirm", 4, FALSE},
+    {"hide", 3, FALSE},
+    {"keepalt", 5, FALSE},
+    {"keepjumps", 5, FALSE},
+    {"keepmarks", 3, FALSE},
+    {"leftabove", 5, FALSE},
+    {"lockmarks", 3, FALSE},
+    {"rightbelow", 6, FALSE},
+    {"sandbox", 3, FALSE},
+    {"silent", 3, FALSE},
+    {"tab", 3, TRUE},
+    {"topleft", 2, FALSE},
+    {"verbose", 4, TRUE},
+    {"vertical", 4, FALSE},
+};
+
+/*
+ * Return length of a command modifier (including optional count).
+ * Return zero when it's not a modifier.
+ */
+    int
+modifier_len(cmd)
+    char_u     *cmd;
+{
+    int                i, j;
+    char_u     *p = cmd;
+
+    if (VIM_ISDIGIT(*cmd))
+       p = skipwhite(skipdigits(cmd));
+    for (i = 0; i < sizeof(cmdmods) / sizeof(struct cmdmod); ++i)
+    {
+       for (j = 0; p[j] != NUL; ++j)
+           if (p[j] != cmdmods[i].name[j])
+               break;
+       if (!isalpha(p[j]) && j >= cmdmods[i].minlen
+                                       && (p == cmd || cmdmods[i].has_count))
+           return j + (p - cmd);
+    }
+    return 0;
+}
+
 /*
  * Return > 0 if an Ex command "name" exists.
  * Return 2 if there is an exact match.
@@ -2977,30 +3028,6 @@ cmd_exists(name)
     int                i;
     int                j;
     char_u     *p;
-    static struct cmdmod
-    {
-       char    *name;
-       int     minlen;
-    } cmdmods[] = {
-       {"aboveleft", 3},
-       {"belowright", 3},
-       {"botright", 2},
-       {"browse", 3},
-       {"confirm", 4},
-       {"hide", 3},
-       {"keepalt", 5},
-       {"keepjumps", 5},
-       {"keepmarks", 3},
-       {"leftabove", 5},
-       {"lockmarks", 3},
-       {"rightbelow", 6},
-       {"sandbox", 3},
-       {"silent", 3},
-       {"tab", 3},
-       {"topleft", 2},
-       {"verbose", 4},
-       {"vertical", 4},
-    };
 
     /* Check command modifiers. */
     for (i = 0; i < sizeof(cmdmods) / sizeof(struct cmdmod); ++i)
index 1523d8f1773a24508402f42a27633d7ed3960d49..a821ef85465feca8c97163241a0ae2c80ac6b283 100644 (file)
@@ -2269,9 +2269,18 @@ ex_endfunction(eap)
 has_loop_cmd(p)
     char_u     *p;
 {
-    p = skipwhite(p);
-    while (*p == ':')
-       p = skipwhite(p + 1);
+    int                len;
+
+    /* skip modifiers, white space and ':' */
+    for (;;)
+    {
+       while (*p == ' ' || *p == '\t' || *p == ':')
+           ++p;
+       len = modifier_len(p);
+       if (len == 0)
+           break;
+       p += len;
+    }
     if ((p[0] == 'w' && p[1] == 'h')
            || (p[0] == 'f' && p[1] == 'o' && p[2] == 'r'))
        return TRUE;
index 22a0f103ceec4286bcbd7234e95d3eab31787d67..5835db096d8744b7273d368e8fdfcaff176f1daf 100644 (file)
@@ -5,6 +5,7 @@ int do_cmdline __ARGS((char_u *cmdline, char_u *(*getline)(int, void *, int), vo
 int getline_equal __ARGS((char_u *(*fgetline)(int, void *, int), void *cookie, char_u *(*func)(int, void *, int)));
 void *getline_cookie __ARGS((char_u *(*fgetline)(int, void *, int), void *cookie));
 int checkforcmd __ARGS((char_u **pp, char *cmd, int len));
+int modifier_len __ARGS((char_u *cmd));
 int cmd_exists __ARGS((char_u *name));
 char_u *set_one_cmd_context __ARGS((expand_T *xp, char_u *buff));
 char_u *skip_range __ARGS((char_u *cmd, int *ctx));
index 846eb45113e609a358ac0d00b238d17af7cf47d5..a60feae04abfa96e4590211afe775bf2f452496e 100644 (file)
@@ -666,6 +666,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    162,
 /**/
     161,
 /**/