]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.423 v7.4.423
authorBram Moolenaar <Bram@vim.org>
Fri, 29 Aug 2014 10:58:44 +0000 (12:58 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 29 Aug 2014 10:58:44 +0000 (12:58 +0200)
Problem:    expand("$shell") does not work as documented.
Solution:   Do not escape the $ when expanding environment variables.

src/misc1.c
src/os_unix.c
src/version.c
src/vim.h

index 6ae72cfbba000f8bcc5cad78f70a80479d1991d1..e3e7da82453662be8d6b1fdc5a2092eb85ad6934 100644 (file)
@@ -78,7 +78,8 @@ get_indent_str(ptr, ts, list)
            if (!list || lcs_tab1)    /* count a tab for what it is worth */
                count += ts - (count % ts);
            else
-       /* in list mode, when tab is not set, count screen char width for Tab: ^I */
+               /* In list mode, when tab is not set, count screen char width
+                * for Tab, displays: ^I */
                count += ptr2cells(ptr);
        }
        else if (*ptr == ' ')
@@ -10767,7 +10768,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
                    vim_free(p);
                    ga_clear_strings(&ga);
                    i = mch_expand_wildcards(num_pat, pat, num_file, file,
-                                                                      flags);
+                                                        flags|EW_KEEPDOLLAR);
                    recursive = FALSE;
                    return i;
                }
index 124c2693bc1dfd6029feaa186c8410af60503692..b49afc3f8aac48f344a3a344ef2974a3bfae0cfd 100644 (file)
@@ -5939,10 +5939,12 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags)
                        *p++ = '\\';
                    ++j;
                }
-               else if (!intick && vim_strchr(SHELL_SPECIAL,
-                                                          pat[i][j]) != NULL)
+               else if (!intick
+                        && ((flags & EW_KEEPDOLLAR) == 0 || pat[i][j] != '$')
+                             && vim_strchr(SHELL_SPECIAL, pat[i][j]) != NULL)
                    /* Put a backslash before a special character, but not
-                    * when inside ``. */
+                    * when inside ``. And not for $var when EW_KEEPDOLLAR is
+                    * set. */
                    *p++ = '\\';
 
                /* Copy one character. */
index 31d1b34d59357bdcdcada019d0df388c602c24f4..d8ed2a03a0e8e28033b567cbf097b410822ff533 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    423,
 /**/
     422,
 /**/
index cb2a9e5b3ba15bb1bf93979855322d23705dc808..2a6d9a044597de559672d340a2372f5401dc7032 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -835,6 +835,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
 #define EW_ICASE       0x100   /* ignore case */
 #define EW_NOERROR     0x200   /* no error for bad regexp */
 #define EW_NOTWILD     0x400   /* add match with literal name if exists */
+#define EW_KEEPDOLLAR  0x800   /* do not escape $, $var is expanded */
 /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
  * is used when executing commands and EW_SILENT for interactive expanding. */