updated for version 7.1-121 v7.1.121
authorBram Moolenaar <Bram@vim.org>
Tue, 25 Sep 2007 18:40:14 +0000 (18:40 +0000)
committerBram Moolenaar <Bram@vim.org>
Tue, 25 Sep 2007 18:40:14 +0000 (18:40 +0000)
src/eval.c
src/version.c

index 61d7df4cfa4f170b766238241661a7287a832552..740b8dd41ff5d230b989114436ddc08fca3bf74f 100644 (file)
@@ -21308,14 +21308,27 @@ repeat:
        *usedlen += 2;
        s = get_past_head(*fnamep);
        while (tail > s && after_pathsep(s, tail))
-           --tail;
+           mb_ptr_back(*fnamep, tail);
        *fnamelen = (int)(tail - *fnamep);
 #ifdef VMS
        if (*fnamelen > 0)
            *fnamelen += 1; /* the path separator is part of the path */
 #endif
-       while (tail > s && !after_pathsep(s, tail))
-           mb_ptr_back(*fnamep, tail);
+       if (*fnamelen == 0)
+       {
+           /* Result is empty.  Turn it into "." to make ":cd %:h" work. */
+           p = vim_strsave((char_u *)".");
+           if (p == NULL)
+               return -1;
+           vim_free(*bufp);
+           *bufp = *fnamep = tail = p;
+           *fnamelen = 1;
+       }
+       else
+       {
+           while (tail > s && !after_pathsep(s, tail))
+               mb_ptr_back(*fnamep, tail);
+       }
     }
 
     /* ":8" - shortname  */
index 0f90b8b4f3d5ed090d1f76c84be4866431ee3c50..aeeb316aa0f7b150a7ed2696ade3a1accd0b669d 100644 (file)
@@ -666,6 +666,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    121,
 /**/
     120,
 /**/