Karsten Hopp a2a199
To: vim_dev@googlegroups.com
Karsten Hopp a2a199
Subject: Patch 7.3.609
Karsten Hopp a2a199
Fcc: outbox
Karsten Hopp a2a199
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp a2a199
Mime-Version: 1.0
Karsten Hopp a2a199
Content-Type: text/plain; charset=UTF-8
Karsten Hopp a2a199
Content-Transfer-Encoding: 8bit
Karsten Hopp a2a199
------------
Karsten Hopp a2a199
Karsten Hopp a2a199
Patch 7.3.609
Karsten Hopp a2a199
Problem:    File names in :checkpath! output are garbled.
Karsten Hopp a2a199
Solution:   Check for \zs in the pattern. (Lech Lorens)
Karsten Hopp a2a199
Files:	    src/search.c, src/testdir/test17.in, src/testdir/test17.ok
Karsten Hopp a2a199
Karsten Hopp a2a199
Karsten Hopp a2a199
*** ../vim-7.3.608/src/search.c	2012-07-19 17:18:21.000000000 +0200
Karsten Hopp a2a199
--- src/search.c	2012-07-25 13:33:08.000000000 +0200
Karsten Hopp a2a199
***************
Karsten Hopp a2a199
*** 4740,4756 ****
Karsten Hopp a2a199
  			 * Isolate the file name.
Karsten Hopp a2a199
  			 * Include the surrounding "" or <> if present.
Karsten Hopp a2a199
  			 */
Karsten Hopp a2a199
! 			for (p = incl_regmatch.endp[0]; !vim_isfilec(*p); p++)
Karsten Hopp a2a199
! 			    ;
Karsten Hopp a2a199
! 			for (i = 0; vim_isfilec(p[i]); i++)
Karsten Hopp a2a199
! 			    ;
Karsten Hopp a2a199
  			if (i == 0)
Karsten Hopp a2a199
  			{
Karsten Hopp a2a199
  			    /* Nothing found, use the rest of the line. */
Karsten Hopp a2a199
  			    p = incl_regmatch.endp[0];
Karsten Hopp a2a199
  			    i = (int)STRLEN(p);
Karsten Hopp a2a199
  			}
Karsten Hopp a2a199
! 			else
Karsten Hopp a2a199
  			{
Karsten Hopp a2a199
  			    if (p[-1] == '"' || p[-1] == '<')
Karsten Hopp a2a199
  			    {
Karsten Hopp a2a199
--- 4740,4772 ----
Karsten Hopp a2a199
  			 * Isolate the file name.
Karsten Hopp a2a199
  			 * Include the surrounding "" or <> if present.
Karsten Hopp a2a199
  			 */
Karsten Hopp a2a199
! 			if (inc_opt != NULL
Karsten Hopp a2a199
! 				   && strstr((char *)inc_opt, "\\zs") != NULL)
Karsten Hopp a2a199
! 			{
Karsten Hopp a2a199
! 			    /* pattern contains \zs, use the match */
Karsten Hopp a2a199
! 			    p = incl_regmatch.startp[0];
Karsten Hopp a2a199
! 			    i = (int)(incl_regmatch.endp[0]
Karsten Hopp a2a199
! 						   - incl_regmatch.startp[0]);
Karsten Hopp a2a199
! 			}
Karsten Hopp a2a199
! 			else
Karsten Hopp a2a199
! 			{
Karsten Hopp a2a199
! 			    /* find the file name after the end of the match */
Karsten Hopp a2a199
! 			    for (p = incl_regmatch.endp[0];
Karsten Hopp a2a199
! 						  *p && !vim_isfilec(*p); p++)
Karsten Hopp a2a199
! 				;
Karsten Hopp a2a199
! 			    for (i = 0; vim_isfilec(p[i]); i++)
Karsten Hopp a2a199
! 				;
Karsten Hopp a2a199
! 			}
Karsten Hopp a2a199
! 
Karsten Hopp a2a199
  			if (i == 0)
Karsten Hopp a2a199
  			{
Karsten Hopp a2a199
  			    /* Nothing found, use the rest of the line. */
Karsten Hopp a2a199
  			    p = incl_regmatch.endp[0];
Karsten Hopp a2a199
  			    i = (int)STRLEN(p);
Karsten Hopp a2a199
  			}
Karsten Hopp a2a199
! 			/* Avoid checking before the start of the line, can
Karsten Hopp a2a199
! 			 * happen if \zs appears in the regexp. */
Karsten Hopp a2a199
! 			else if (p > line)
Karsten Hopp a2a199
  			{
Karsten Hopp a2a199
  			    if (p[-1] == '"' || p[-1] == '<')
Karsten Hopp a2a199
  			    {
Karsten Hopp a2a199
*** ../vim-7.3.608/src/testdir/test17.in	2010-08-15 21:57:29.000000000 +0200
Karsten Hopp a2a199
--- src/testdir/test17.in	2012-07-25 13:41:43.000000000 +0200
Karsten Hopp a2a199
***************
Karsten Hopp a2a199
*** 1,4 ****
Karsten Hopp a2a199
! Tests for "gf" on ${VAR}
Karsten Hopp a2a199
  
Karsten Hopp a2a199
  STARTTEST
Karsten Hopp a2a199
  :so small.vim
Karsten Hopp a2a199
--- 1,6 ----
Karsten Hopp a2a199
! Tests for:
Karsten Hopp a2a199
! - "gf" on ${VAR},
Karsten Hopp a2a199
! - ":checkpath!" with various 'include' settings.
Karsten Hopp a2a199
  
Karsten Hopp a2a199
  STARTTEST
Karsten Hopp a2a199
  :so small.vim
Karsten Hopp a2a199
***************
Karsten Hopp a2a199
*** 20,27 ****
Karsten Hopp a2a199
  :endif
Karsten Hopp a2a199
  gf
Karsten Hopp a2a199
  :w! test.out
Karsten Hopp a2a199
! :qa!
Karsten Hopp a2a199
  ENDTEST
Karsten Hopp a2a199
  
Karsten Hopp a2a199
  	${CDIR}/test17a.in
Karsten Hopp a2a199
  	$TDIR/test17a.in
Karsten Hopp a2a199
--- 22,120 ----
Karsten Hopp a2a199
  :endif
Karsten Hopp a2a199
  gf
Karsten Hopp a2a199
  :w! test.out
Karsten Hopp a2a199
! :brewind
Karsten Hopp a2a199
  ENDTEST
Karsten Hopp a2a199
  
Karsten Hopp a2a199
  	${CDIR}/test17a.in
Karsten Hopp a2a199
  	$TDIR/test17a.in
Karsten Hopp a2a199
+ 
Karsten Hopp a2a199
+ STARTTEST
Karsten Hopp a2a199
+ :" check for 'include' without \zs or \ze
Karsten Hopp a2a199
+ :lang C
Karsten Hopp a2a199
+ :!rm -f ./Xbase.a
Karsten Hopp a2a199
+ :!rm -rf ./Xdir1
Karsten Hopp a2a199
+ :!mkdir -p Xdir1/dir2
Karsten Hopp a2a199
+ :e Xdir1/dir2/foo.a
Karsten Hopp a2a199
+ i#include   "bar.a"?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :e Xdir1/dir2/bar.a
Karsten Hopp a2a199
+ i#include      "baz.a"?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :e Xdir1/dir2/baz.a
Karsten Hopp a2a199
+ i#include            "foo.a"?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :e Xbase.a
Karsten Hopp a2a199
+ :set path=Xdir1/dir2
Karsten Hopp a2a199
+ i#include    <foo.a>?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :redir! >>test.out
Karsten Hopp a2a199
+ :checkpath!
Karsten Hopp a2a199
+ :redir END
Karsten Hopp a2a199
+ :brewind
Karsten Hopp a2a199
+ ENDTEST
Karsten Hopp a2a199
+ 
Karsten Hopp a2a199
+ STARTTEST
Karsten Hopp a2a199
+ :" check for 'include' with \zs and \ze
Karsten Hopp a2a199
+ :!rm -f ./Xbase.b
Karsten Hopp a2a199
+ :!rm -rf ./Xdir1
Karsten Hopp a2a199
+ :!mkdir -p Xdir1/dir2
Karsten Hopp a2a199
+ :let &include='^\s*%inc\s*/\zs[^/]\+\ze'
Karsten Hopp a2a199
+ :function! DotsToSlashes()
Karsten Hopp a2a199
+ :  return substitute(v:fname, '\.', '/', 'g') . '.b'
Karsten Hopp a2a199
+ :endfunction
Karsten Hopp a2a199
+ :let &includeexpr='DotsToSlashes()'
Karsten Hopp a2a199
+ :e Xdir1/dir2/foo.b
Karsten Hopp a2a199
+ i%inc   /bar/?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :e Xdir1/dir2/bar.b
Karsten Hopp a2a199
+ i%inc      /baz/?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :e Xdir1/dir2/baz.b
Karsten Hopp a2a199
+ i%inc            /foo/?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :e Xbase.b
Karsten Hopp a2a199
+ :set path=Xdir1/dir2
Karsten Hopp a2a199
+ i%inc    /foo/?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :redir! >>test.out
Karsten Hopp a2a199
+ :checkpath!
Karsten Hopp a2a199
+ :redir END
Karsten Hopp a2a199
+ :brewind
Karsten Hopp a2a199
+ ENDTEST
Karsten Hopp a2a199
+ 
Karsten Hopp a2a199
+ STARTTEST
Karsten Hopp a2a199
+ :" check for 'include' with \zs and no \ze
Karsten Hopp a2a199
+ :!rm -f ./Xbase.c
Karsten Hopp a2a199
+ :!rm -rf ./Xdir1
Karsten Hopp a2a199
+ :!mkdir -p Xdir1/dir2
Karsten Hopp a2a199
+ :let &include='^\s*%inc\s*\%([[:upper:]][^[:space:]]*\s\+\)\?\zs\S\+\ze'
Karsten Hopp a2a199
+ :function! StripNewlineChar()
Karsten Hopp a2a199
+ :  if v:fname =~ '\n$'
Karsten Hopp a2a199
+ :    return v:fname[:-2]
Karsten Hopp a2a199
+ :  endif
Karsten Hopp a2a199
+ :  return v:fname
Karsten Hopp a2a199
+ :endfunction
Karsten Hopp a2a199
+ :let &includeexpr='StripNewlineChar()'
Karsten Hopp a2a199
+ :e Xdir1/dir2/foo.c
Karsten Hopp a2a199
+ i%inc   bar.c?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :e Xdir1/dir2/bar.c
Karsten Hopp a2a199
+ i%inc      baz.c?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :e Xdir1/dir2/baz.c
Karsten Hopp a2a199
+ i%inc            foo.c?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :e Xdir1/dir2/FALSE.c
Karsten Hopp a2a199
+ i%inc            foo.c?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :e Xbase.c
Karsten Hopp a2a199
+ :set path=Xdir1/dir2
Karsten Hopp a2a199
+ i%inc    FALSE.c foo.c?
Karsten Hopp a2a199
+ :w
Karsten Hopp a2a199
+ :redir! >>test.out
Karsten Hopp a2a199
+ :checkpath!
Karsten Hopp a2a199
+ :redir END
Karsten Hopp a2a199
+ :brewind
Karsten Hopp a2a199
+ :q
Karsten Hopp a2a199
+ ENDTEST
Karsten Hopp a2a199
+ 
Karsten Hopp a2a199
*** ../vim-7.3.608/src/testdir/test17.ok	2010-08-15 21:57:29.000000000 +0200
Karsten Hopp a2a199
--- src/testdir/test17.ok	2012-07-25 13:45:37.000000000 +0200
Karsten Hopp a2a199
***************
Karsten Hopp a2a199
*** 1,3 ****
Karsten Hopp a2a199
--- 1,33 ----
Karsten Hopp a2a199
  This file is just to test "gf" in test 17.
Karsten Hopp a2a199
  The contents is not important.
Karsten Hopp a2a199
  Just testing!
Karsten Hopp a2a199
+ 
Karsten Hopp a2a199
+ 
Karsten Hopp a2a199
+ --- Included files in path ---
Karsten Hopp a2a199
+ Xdir1/dir2/foo.a
Karsten Hopp a2a199
+ Xdir1/dir2/foo.a -->
Karsten Hopp a2a199
+   Xdir1/dir2/bar.a
Karsten Hopp a2a199
+   Xdir1/dir2/bar.a -->
Karsten Hopp a2a199
+     Xdir1/dir2/baz.a
Karsten Hopp a2a199
+     Xdir1/dir2/baz.a -->
Karsten Hopp a2a199
+       "foo.a"  (Already listed)
Karsten Hopp a2a199
+ 
Karsten Hopp a2a199
+ 
Karsten Hopp a2a199
+ --- Included files in path ---
Karsten Hopp a2a199
+ Xdir1/dir2/foo.b
Karsten Hopp a2a199
+ Xdir1/dir2/foo.b -->
Karsten Hopp a2a199
+   Xdir1/dir2/bar.b
Karsten Hopp a2a199
+   Xdir1/dir2/bar.b -->
Karsten Hopp a2a199
+     Xdir1/dir2/baz.b
Karsten Hopp a2a199
+     Xdir1/dir2/baz.b -->
Karsten Hopp a2a199
+       foo  (Already listed)
Karsten Hopp a2a199
+ 
Karsten Hopp a2a199
+ 
Karsten Hopp a2a199
+ --- Included files in path ---
Karsten Hopp a2a199
+ Xdir1/dir2/foo.c
Karsten Hopp a2a199
+ Xdir1/dir2/foo.c -->
Karsten Hopp a2a199
+   Xdir1/dir2/bar.c
Karsten Hopp a2a199
+   Xdir1/dir2/bar.c -->
Karsten Hopp a2a199
+     Xdir1/dir2/baz.c
Karsten Hopp a2a199
+     Xdir1/dir2/baz.c -->
Karsten Hopp a2a199
+       foo.c^@  (Already listed)
Karsten Hopp a2a199
*** ../vim-7.3.608/src/version.c	2012-07-19 18:05:40.000000000 +0200
Karsten Hopp a2a199
--- src/version.c	2012-07-25 13:38:54.000000000 +0200
Karsten Hopp a2a199
***************
Karsten Hopp a2a199
*** 716,717 ****
Karsten Hopp a2a199
--- 716,719 ----
Karsten Hopp a2a199
  {   /* Add new patch number below this line */
Karsten Hopp a2a199
+ /**/
Karsten Hopp a2a199
+     609,
Karsten Hopp a2a199
  /**/
Karsten Hopp a2a199
Karsten Hopp a2a199
-- 
Karsten Hopp a2a199
"The question of whether computers can think is just like the question
Karsten Hopp a2a199
of whether submarines can swim."      -- Edsger W. Dijkstra
Karsten Hopp a2a199
Karsten Hopp a2a199
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp a2a199
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp a2a199
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp a2a199
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///