diff src/misc2.c @ 6633:75444015837a v7.4.642

updated for version 7.4.642 Problem: When using "gf" escaped spaces are not handled. Solution: Recognize escaped spaces.
author Bram Moolenaar <bram@vim.org>
date Fri, 27 Feb 2015 17:19:10 +0100
parents 96761b6789f6
children 8bee881c3ca5
line wrap: on
line diff
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -5474,6 +5474,7 @@ free_findfile()
  *
  * options:
  * FNAME_MESS	    give error message when not found
+ * FNAME_UNESC	    unescape backslashes.
  *
  * Uses NameBuff[]!
  *
@@ -5491,7 +5492,8 @@ find_directory_in_path(ptr, len, options
 }
 
     char_u *
-find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_fname, suffixes)
+find_file_in_path_option(ptr, len, options, first, path_option,
+			 find_what, rel_fname, suffixes)
     char_u	*ptr;		/* file name */
     int		len;		/* length of file name */
     int		options;
@@ -5530,6 +5532,13 @@ find_file_in_path_option(ptr, len, optio
 	    file_name = NULL;
 	    goto theend;
 	}
+	if (options & FNAME_UNESC)
+	{
+	    /* Change all "\ " to " ". */
+	    for (ptr = ff_file_to_find; *ptr != NUL; ++ptr)
+		if (ptr[0] == '\\' && ptr[1] == ' ')
+		    mch_memmove(ptr, ptr + 1, STRLEN(ptr));
+	}
     }
 
     rel_to_curdir = (ff_file_to_find[0] == '.'