]> granicus.if.org Git - vim/commitdiff
updated for version 7.1-123 v7.1.123
authorBram Moolenaar <Bram@vim.org>
Wed, 26 Sep 2007 20:36:32 +0000 (20:36 +0000)
committerBram Moolenaar <Bram@vim.org>
Wed, 26 Sep 2007 20:36:32 +0000 (20:36 +0000)
src/ex_docmd.c
src/misc1.c
src/option.c
src/proto/misc1.pro
src/version.c

index 0b33e7994d1b92e69b047a72aa0d79a884d6c60c..3b874e79c2673a9bee60f72d05063ba589f561a1 100644 (file)
@@ -4403,7 +4403,7 @@ expand_filename(eap, cmdlinep, errormsgp)
                            || vim_strchr(eap->arg, '~') != NULL)
                    {
                        expand_env_esc(eap->arg, NameBuff, MAXPATHL,
-                                                                TRUE, NULL);
+                                                           TRUE, TRUE, NULL);
                        has_wildcards = mch_has_wildcard(NameBuff);
                        p = NameBuff;
                    }
index 5f40e0ab9806417617099d73a6bdd692f6d057f3..b67405fb40edff767aeb21babdfa91c9d38e9e22 100644 (file)
@@ -3505,10 +3505,39 @@ free_homedir()
 }
 #endif
 
+/*
+ * Call expand_env() and store the result in an allocated string.
+ * This is not very memory efficient, this expects the result to be freed
+ * again soon.
+ */
+    char_u *
+expand_env_save(src)
+    char_u     *src;
+{
+    return expand_env_save_opt(src, FALSE);
+}
+
+/*
+ * Idem, but when "one" is TRUE handle the string as one file name, only
+ * expand "~" at the start.
+ */
+    char_u *
+expand_env_save_opt(src, one)
+    char_u     *src;
+    int                one;
+{
+    char_u     *p;
+
+    p = alloc(MAXPATHL);
+    if (p != NULL)
+       expand_env_esc(src, p, MAXPATHL, FALSE, one, NULL);
+    return p;
+}
+
 /*
  * Expand environment variable with path name.
  * "~/" is also expanded, using $HOME. For Unix "~user/" is expanded.
- * Skips over "\ ", "\~" and "\$".
+ * Skips over "\ ", "\~" and "\$" (not for Win32 though).
  * If anything fails no expansion is done and dst equals src.
  */
     void
@@ -3517,15 +3546,16 @@ expand_env(src, dst, dstlen)
     char_u     *dst;           /* where to put the result */
     int                dstlen;         /* maximum length of the result */
 {
-    expand_env_esc(src, dst, dstlen, FALSE, NULL);
+    expand_env_esc(src, dst, dstlen, FALSE, FALSE, NULL);
 }
 
     void
-expand_env_esc(srcp, dst, dstlen, esc, startstr)
+expand_env_esc(srcp, dst, dstlen, esc, one, startstr)
     char_u     *srcp;          /* input string e.g. "$HOME/vim.hlp" */
     char_u     *dst;           /* where to put the result */
     int                dstlen;         /* maximum length of the result */
     int                esc;            /* escape spaces in expanded variables */
+    int                one;            /* "srcp" is one file name */
     char_u     *startstr;      /* start again after this (can be NULL) */
 {
     char_u     *src;
@@ -3766,6 +3796,8 @@ expand_env_esc(srcp, dst, dstlen, esc, startstr)
        {
            /*
             * Recognize the start of a new name, for '~'.
+            * Don't do this when "one" is TRUE, to avoid expanding "~" in
+            * ":edit foo ~ foo".
             */
            at_start = FALSE;
            if (src[0] == '\\' && src[1] != NUL)
@@ -3773,7 +3805,7 @@ expand_env_esc(srcp, dst, dstlen, esc, startstr)
                *dst++ = *src++;
                --dstlen;
            }
-           else if (src[0] == ' ' || src[0] == ',')
+           else if ((src[0] == ' ' || src[0] == ',') && !one)
                at_start = TRUE;
            *dst++ = *src++;
            --dstlen;
@@ -4069,23 +4101,6 @@ remove_tail(p, pend, name)
     return pend;
 }
 
-/*
- * Call expand_env() and store the result in an allocated string.
- * This is not very memory efficient, this expects the result to be freed
- * again soon.
- */
-    char_u *
-expand_env_save(src)
-    char_u     *src;
-{
-    char_u     *p;
-
-    p = alloc(MAXPATHL);
-    if (p != NULL)
-       expand_env(src, p, MAXPATHL);
-    return p;
-}
-
 /*
  * Our portable version of setenv.
  */
@@ -9139,7 +9154,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
             */
            if (vim_strpbrk(p, (char_u *)"$~") != NULL)
            {
-               p = expand_env_save(p);
+               p = expand_env_save_opt(p, TRUE);
                if (p == NULL)
                    p = pat[i];
 #ifdef UNIX
index 0bdc0a4007ce578b2e3f13975ae5c7e30155c49d..a8aded520200f74a1ca5399f5691df3834bc3789 100644 (file)
@@ -4996,7 +4996,7 @@ option_expand(opt_idx, val)
      * For 'spellsuggest' expand after "file:".
      */
     expand_env_esc(val, NameBuff, MAXPATHL,
-           (char_u **)options[opt_idx].var == &p_tags,
+           (char_u **)options[opt_idx].var == &p_tags, FALSE,
 #ifdef FEAT_SPELL
            (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" :
 #endif
index e9bc32c559116368368aaaf2cf88905be8a8cdde..a54b8b5695befe8ec5c990527134e39657ed638f 100644 (file)
@@ -48,10 +48,11 @@ void beep_flush __ARGS((void));
 void vim_beep __ARGS((void));
 void init_homedir __ARGS((void));
 void free_homedir __ARGS((void));
+char_u *expand_env_save __ARGS((char_u *src));
+char_u *expand_env_save_opt __ARGS((char_u *src, int one));
 void expand_env __ARGS((char_u *src, char_u *dst, int dstlen));
-void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, char_u *startstr));
+void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, int one, char_u *startstr));
 char_u *vim_getenv __ARGS((char_u *name, int *mustfree));
-char_u *expand_env_save __ARGS((char_u *src));
 void vim_setenv __ARGS((char_u *name, char_u *val));
 char_u *get_env_name __ARGS((expand_T *xp, int idx));
 void home_replace __ARGS((buf_T *buf, char_u *src, char_u *dst, int dstlen, int one));
index 21f538cdbb9c4e855b8758b8b675db3d19ff3f4b..8dcac6be9d52200e039b8e97b15dcd6ddc709091 100644 (file)
@@ -666,6 +666,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    123,
 /**/
     122,
 /**/