]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.4.642 v7.4.642
authorBram Moolenaar <Bram@vim.org>
Fri, 27 Feb 2015 16:19:10 +0000 (17:19 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 27 Feb 2015 16:19:10 +0000 (17:19 +0100)
Problem:    When using "gf" escaped spaces are not handled.
Solution:   Recognize escaped spaces.

src/misc2.c
src/version.c
src/vim.h
src/window.c

index d421a00bc0b133725c8039c1a2d17b2fb4cf9270..8f19578df69c22e969c88b42d4192711e6d391b5 100644 (file)
@@ -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, rel_fname)
 }
 
     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, options, first, path_option, find_what, rel_f
            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] == '.'
index 34c6959720931e5c61c654051b51bd61b6f19a30..d9e9192827055faa7a974dc9d2bc437ab3845058 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    642,
 /**/
     641,
 /**/
index a7bb00170cb2bc79aa833618259518e388105470..61cd5b900ca88f374bc1eae02094a4075112dece 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -939,6 +939,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
 #define FNAME_INCL     8       /* apply 'includeexpr' */
 #define FNAME_REL      16      /* ".." and "./" are relative to the (current)
                                   file instead of the current directory */
+#define FNAME_UNESC    32      /* remove backslashes used for escaping */
 
 /* Values for buflist_getfile() */
 #define GETF_SETMARK   0x01    /* set pcmark before jumping */
index 6ca288ead28df8676d13eb90a7bbbfd55aad3ca6..eb218d5603394e65f3a50caa606eaa8d68acf9e3 100644 (file)
@@ -6219,6 +6219,8 @@ grab_file_name(count, file_lnum)
     long       count;
     linenr_T   *file_lnum;
 {
+    int options = FNAME_MESS|FNAME_EXP|FNAME_REL|FNAME_UNESC;
+
     if (VIsual_active)
     {
        int     len;
@@ -6226,11 +6228,10 @@ grab_file_name(count, file_lnum)
 
        if (get_visual_text(NULL, &ptr, &len) == FAIL)
            return NULL;
-       return find_file_name_in_path(ptr, len,
-                    FNAME_MESS|FNAME_EXP|FNAME_REL, count, curbuf->b_ffname);
+       return find_file_name_in_path(ptr, len, options,
+                                                    count, curbuf->b_ffname);
     }
-    return file_name_at_cursor(FNAME_MESS|FNAME_HYP|FNAME_EXP|FNAME_REL, count,
-                              file_lnum);
+    return file_name_at_cursor(options | FNAME_HYP, count, file_lnum);
 
 }
 
@@ -6310,14 +6311,19 @@ file_name_in_line(line, col, options, count, rel_fname, file_lnum)
      * Also allow "://" when ':' is not in 'isfname'.
      */
     len = 0;
-    while (vim_isfilec(ptr[len])
+    while (vim_isfilec(ptr[len]) || (ptr[len] == '\\' && ptr[len + 1] == ' ')
                         || ((options & FNAME_HYP) && path_is_url(ptr + len)))
+    {
+       if (ptr[len] == '\\')
+           /* Skip over the "\" in "\ ". */
+           ++len;
 #ifdef FEAT_MBYTE
        if (has_mbyte)
            len += (*mb_ptr2len)(ptr + len);
        else
 #endif
            ++len;
+    }
 
     /*
      * If there is trailing punctuation, remove it.