Karsten Hopp 80b825
To: vim_dev@googlegroups.com
Karsten Hopp 80b825
Subject: Patch 7.4.642
Karsten Hopp 80b825
Fcc: outbox
Karsten Hopp 80b825
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 80b825
Mime-Version: 1.0
Karsten Hopp 80b825
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 80b825
Content-Transfer-Encoding: 8bit
Karsten Hopp 80b825
------------
Karsten Hopp 80b825
Karsten Hopp 80b825
Patch 7.4.642
Karsten Hopp 80b825
Problem:    When using "gf" escaped spaces are not handled.
Karsten Hopp 80b825
Solution:   Recognize escaped spaces.
Karsten Hopp 80b825
Files:	    src/vim.h, src/normal.h, src/window.c, src/misc2.c
Karsten Hopp 80b825
Karsten Hopp 80b825
Karsten Hopp 80b825
*** ../vim-7.4.641/src/vim.h	2015-02-10 18:47:55.225390610 +0100
Karsten Hopp 80b825
--- src/vim.h	2015-02-27 16:32:33.508503398 +0100
Karsten Hopp 80b825
***************
Karsten Hopp 80b825
*** 939,944 ****
Karsten Hopp 80b825
--- 939,945 ----
Karsten Hopp 80b825
  #define FNAME_INCL	8	/* apply 'includeexpr' */
Karsten Hopp 80b825
  #define FNAME_REL	16	/* ".." and "./" are relative to the (current)
Karsten Hopp 80b825
  				   file instead of the current directory */
Karsten Hopp 80b825
+ #define FNAME_UNESC	32	/* remove backslashes used for escaping */
Karsten Hopp 80b825
  
Karsten Hopp 80b825
  /* Values for buflist_getfile() */
Karsten Hopp 80b825
  #define GETF_SETMARK	0x01	/* set pcmark before jumping */
Karsten Hopp 80b825
*** ../vim-7.4.641/src/window.c	2015-01-14 15:47:33.076036876 +0100
Karsten Hopp 80b825
--- src/window.c	2015-02-27 17:18:32.653331499 +0100
Karsten Hopp 80b825
***************
Karsten Hopp 80b825
*** 6219,6224 ****
Karsten Hopp 80b825
--- 6219,6226 ----
Karsten Hopp 80b825
      long	count;
Karsten Hopp 80b825
      linenr_T	*file_lnum;
Karsten Hopp 80b825
  {
Karsten Hopp 80b825
+     int options = FNAME_MESS|FNAME_EXP|FNAME_REL|FNAME_UNESC;
Karsten Hopp 80b825
+ 
Karsten Hopp 80b825
      if (VIsual_active)
Karsten Hopp 80b825
      {
Karsten Hopp 80b825
  	int	len;
Karsten Hopp 80b825
***************
Karsten Hopp 80b825
*** 6226,6236 ****
Karsten Hopp 80b825
  
Karsten Hopp 80b825
  	if (get_visual_text(NULL, &ptr, &len) == FAIL)
Karsten Hopp 80b825
  	    return NULL;
Karsten Hopp 80b825
! 	return find_file_name_in_path(ptr, len,
Karsten Hopp 80b825
! 		     FNAME_MESS|FNAME_EXP|FNAME_REL, count, curbuf->b_ffname);
Karsten Hopp 80b825
      }
Karsten Hopp 80b825
!     return file_name_at_cursor(FNAME_MESS|FNAME_HYP|FNAME_EXP|FNAME_REL, count,
Karsten Hopp 80b825
! 			       file_lnum);
Karsten Hopp 80b825
  
Karsten Hopp 80b825
  }
Karsten Hopp 80b825
  
Karsten Hopp 80b825
--- 6228,6237 ----
Karsten Hopp 80b825
  
Karsten Hopp 80b825
  	if (get_visual_text(NULL, &ptr, &len) == FAIL)
Karsten Hopp 80b825
  	    return NULL;
Karsten Hopp 80b825
! 	return find_file_name_in_path(ptr, len, options,
Karsten Hopp 80b825
! 						     count, curbuf->b_ffname);
Karsten Hopp 80b825
      }
Karsten Hopp 80b825
!     return file_name_at_cursor(options | FNAME_HYP, count, file_lnum);
Karsten Hopp 80b825
  
Karsten Hopp 80b825
  }
Karsten Hopp 80b825
  
Karsten Hopp 80b825
***************
Karsten Hopp 80b825
*** 6310,6323 ****
Karsten Hopp 80b825
       * Also allow "://" when ':' is not in 'isfname'.
Karsten Hopp 80b825
       */
Karsten Hopp 80b825
      len = 0;
Karsten Hopp 80b825
!     while (vim_isfilec(ptr[len])
Karsten Hopp 80b825
  			 || ((options & FNAME_HYP) && path_is_url(ptr + len)))
Karsten Hopp 80b825
  #ifdef FEAT_MBYTE
Karsten Hopp 80b825
  	if (has_mbyte)
Karsten Hopp 80b825
  	    len += (*mb_ptr2len)(ptr + len);
Karsten Hopp 80b825
  	else
Karsten Hopp 80b825
  #endif
Karsten Hopp 80b825
  	    ++len;
Karsten Hopp 80b825
  
Karsten Hopp 80b825
      /*
Karsten Hopp 80b825
       * If there is trailing punctuation, remove it.
Karsten Hopp 80b825
--- 6311,6329 ----
Karsten Hopp 80b825
       * Also allow "://" when ':' is not in 'isfname'.
Karsten Hopp 80b825
       */
Karsten Hopp 80b825
      len = 0;
Karsten Hopp 80b825
!     while (vim_isfilec(ptr[len]) || (ptr[len] == '\\' && ptr[len + 1] == ' ')
Karsten Hopp 80b825
  			 || ((options & FNAME_HYP) && path_is_url(ptr + len)))
Karsten Hopp 80b825
+     {
Karsten Hopp 80b825
+ 	if (ptr[len] == '\\')
Karsten Hopp 80b825
+ 	    /* Skip over the "\" in "\ ". */
Karsten Hopp 80b825
+ 	    ++len;
Karsten Hopp 80b825
  #ifdef FEAT_MBYTE
Karsten Hopp 80b825
  	if (has_mbyte)
Karsten Hopp 80b825
  	    len += (*mb_ptr2len)(ptr + len);
Karsten Hopp 80b825
  	else
Karsten Hopp 80b825
  #endif
Karsten Hopp 80b825
  	    ++len;
Karsten Hopp 80b825
+     }
Karsten Hopp 80b825
  
Karsten Hopp 80b825
      /*
Karsten Hopp 80b825
       * If there is trailing punctuation, remove it.
Karsten Hopp 80b825
*** ../vim-7.4.641/src/misc2.c	2014-09-23 16:49:38.798809517 +0200
Karsten Hopp 80b825
--- src/misc2.c	2015-02-27 16:44:00.628733333 +0100
Karsten Hopp 80b825
***************
Karsten Hopp 80b825
*** 5474,5479 ****
Karsten Hopp 80b825
--- 5474,5480 ----
Karsten Hopp 80b825
   *
Karsten Hopp 80b825
   * options:
Karsten Hopp 80b825
   * FNAME_MESS	    give error message when not found
Karsten Hopp 80b825
+  * FNAME_UNESC	    unescape backslashes.
Karsten Hopp 80b825
   *
Karsten Hopp 80b825
   * Uses NameBuff[]!
Karsten Hopp 80b825
   *
Karsten Hopp 80b825
***************
Karsten Hopp 80b825
*** 5491,5497 ****
Karsten Hopp 80b825
  }
Karsten Hopp 80b825
  
Karsten Hopp 80b825
      char_u *
Karsten Hopp 80b825
! find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_fname, suffixes)
Karsten Hopp 80b825
      char_u	*ptr;		/* file name */
Karsten Hopp 80b825
      int		len;		/* length of file name */
Karsten Hopp 80b825
      int		options;
Karsten Hopp 80b825
--- 5492,5499 ----
Karsten Hopp 80b825
  }
Karsten Hopp 80b825
  
Karsten Hopp 80b825
      char_u *
Karsten Hopp 80b825
! find_file_in_path_option(ptr, len, options, first, path_option,
Karsten Hopp 80b825
! 			 find_what, rel_fname, suffixes)
Karsten Hopp 80b825
      char_u	*ptr;		/* file name */
Karsten Hopp 80b825
      int		len;		/* length of file name */
Karsten Hopp 80b825
      int		options;
Karsten Hopp 80b825
***************
Karsten Hopp 80b825
*** 5530,5535 ****
Karsten Hopp 80b825
--- 5532,5544 ----
Karsten Hopp 80b825
  	    file_name = NULL;
Karsten Hopp 80b825
  	    goto theend;
Karsten Hopp 80b825
  	}
Karsten Hopp 80b825
+ 	if (options & FNAME_UNESC)
Karsten Hopp 80b825
+ 	{
Karsten Hopp 80b825
+ 	    /* Change all "\ " to " ". */
Karsten Hopp 80b825
+ 	    for (ptr = ff_file_to_find; *ptr != NUL; ++ptr)
Karsten Hopp 80b825
+ 		if (ptr[0] == '\\' && ptr[1] == ' ')
Karsten Hopp 80b825
+ 		    mch_memmove(ptr, ptr + 1, STRLEN(ptr));
Karsten Hopp 80b825
+ 	}
Karsten Hopp 80b825
      }
Karsten Hopp 80b825
  
Karsten Hopp 80b825
      rel_to_curdir = (ff_file_to_find[0] == '.'
Karsten Hopp 80b825
*** ../vim-7.4.641/src/version.c	2015-02-27 15:03:54.372707934 +0100
Karsten Hopp 80b825
--- src/version.c	2015-02-27 16:53:33.642257892 +0100
Karsten Hopp 80b825
***************
Karsten Hopp 80b825
*** 743,744 ****
Karsten Hopp 80b825
--- 743,746 ----
Karsten Hopp 80b825
  {   /* Add new patch number below this line */
Karsten Hopp 80b825
+ /**/
Karsten Hopp 80b825
+     642,
Karsten Hopp 80b825
  /**/
Karsten Hopp 80b825
Karsten Hopp 80b825
-- 
Karsten Hopp 80b825
press CTRL-ALT-DEL for more information
Karsten Hopp 80b825
Karsten Hopp 80b825
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 80b825
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 80b825
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 80b825
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///