Fix completion of file names with '%' and '*'.
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index 5a123a8..14c46ed 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -208,7 +208,7 @@
 
 !include <Win32.mak>
 
-# May turn on Win64 compatibility warnings for VC7.x and VC8.
+# Flag to turn on Win64 compatibility warnings for VC7.x and VC8.
 WP64CHECK = /Wp64
 
 #>>>>> path of the compiler and linker; name of include and lib directories
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 6e74a23..e8b6f7c 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4091,6 +4091,7 @@
     int		i, j;
     int		new_len;
     char_u	*tail;
+    int		ends_in_star;
 
     if (context != EXPAND_FILES
 	    && context != EXPAND_SHELLCMD
@@ -4181,8 +4182,17 @@
 	     * When the name ends in '$' don't add a star, remove the '$'.
 	     */
 	    tail = gettail(retval);
+	    ends_in_star = (len > 0 && retval[len - 1] == '*');
+#ifndef BACKSLASH_IN_FILENAME
+	    for (i = len - 2; i >= 0; --i)
+	    {
+		if (retval[i] != '\\')
+		    break;
+		ends_in_star = !ends_in_star;
+	    }
+#endif
 	    if ((*retval != '~' || tail != retval)
-		    && (len == 0 || retval[len - 1] != '*')
+		    && !ends_in_star
 		    && vim_strchr(tail, '$') == NULL
 		    && vim_strchr(retval, '`') == NULL)
 		retval[len++] = '*';
diff --git a/src/fileio.c b/src/fileio.c
index 2685101..4a9a7f1 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -10189,6 +10189,13 @@
 		    }
 		}
 #endif
+		/* Undo escaping from ExpandEscape():
+		 * foo\?bar -> foo?bar
+		 * foo\%bar -> foo%bar
+		 * foo\,bar -> foo,bar
+		 * foo\ bar -> foo bar
+		 * Don't unescape \, * and others that are also special in a
+		 * regexp. */
 		if (*++p == '?'
 #ifdef BACKSLASH_IN_FILENAME
 			&& no_bslash
@@ -10196,8 +10203,8 @@
 			)
 		    reg_pat[i++] = '?';
 		else
-		    if (*p == ',')
-			reg_pat[i++] = ',';
+		    if (*p == ',' || *p == '%' || *p == '#' || *p == ' ')
+			reg_pat[i++] = *p;
 		    else
 		    {
 			if (allow_dirs != NULL && vim_ispathsep(*p)