Karsten Hopp 74c289
To: vim_dev@googlegroups.com
Karsten Hopp 74c289
Subject: Patch 7.3.877
Karsten Hopp 74c289
Fcc: outbox
Karsten Hopp 74c289
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 74c289
Mime-Version: 1.0
Karsten Hopp 74c289
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 74c289
Content-Transfer-Encoding: 8bit
Karsten Hopp 74c289
------------
Karsten Hopp 74c289
Karsten Hopp 74c289
Patch 7.3.877 (after 7.3.871)
Karsten Hopp 74c289
Problem:    Forward searching with search() is broken.
Karsten Hopp 74c289
Solution:   Fix it and add tests. (Sung Pae)
Karsten Hopp 74c289
Files:	    src/search.c, src/testdir/test14.in, src/testdir/test14.ok
Karsten Hopp 74c289
Karsten Hopp 74c289
Karsten Hopp 74c289
*** ../vim-7.3.876/src/search.c	2013-03-19 15:27:43.000000000 +0100
Karsten Hopp 74c289
--- src/search.c	2013-04-03 21:07:11.000000000 +0200
Karsten Hopp 74c289
***************
Karsten Hopp 74c289
*** 727,733 ****
Karsten Hopp 74c289
  					++matchcol;
Karsten Hopp 74c289
  				}
Karsten Hopp 74c289
  			    }
Karsten Hopp 74c289
! 			    if (options & SEARCH_START)
Karsten Hopp 74c289
  				break;
Karsten Hopp 74c289
  			    if (ptr[matchcol] == NUL
Karsten Hopp 74c289
  				    || (nmatched = vim_regexec_multi(&regmatch,
Karsten Hopp 74c289
--- 727,733 ----
Karsten Hopp 74c289
  					++matchcol;
Karsten Hopp 74c289
  				}
Karsten Hopp 74c289
  			    }
Karsten Hopp 74c289
! 			    if (matchcol == 0 && (options & SEARCH_START))
Karsten Hopp 74c289
  				break;
Karsten Hopp 74c289
  			    if (ptr[matchcol] == NUL
Karsten Hopp 74c289
  				    || (nmatched = vim_regexec_multi(&regmatch,
Karsten Hopp 74c289
***************
Karsten Hopp 74c289
*** 869,875 ****
Karsten Hopp 74c289
  		    /* With the SEARCH_END option move to the last character
Karsten Hopp 74c289
  		     * of the match.  Don't do it for an empty match, end
Karsten Hopp 74c289
  		     * should be same as start then. */
Karsten Hopp 74c289
! 		    if (options & SEARCH_END && !(options & SEARCH_NOOF)
Karsten Hopp 74c289
  			    && !(matchpos.lnum == endpos.lnum
Karsten Hopp 74c289
  				&& matchpos.col == endpos.col))
Karsten Hopp 74c289
  		    {
Karsten Hopp 74c289
--- 869,875 ----
Karsten Hopp 74c289
  		    /* With the SEARCH_END option move to the last character
Karsten Hopp 74c289
  		     * of the match.  Don't do it for an empty match, end
Karsten Hopp 74c289
  		     * should be same as start then. */
Karsten Hopp 74c289
! 		    if ((options & SEARCH_END) && !(options & SEARCH_NOOF)
Karsten Hopp 74c289
  			    && !(matchpos.lnum == endpos.lnum
Karsten Hopp 74c289
  				&& matchpos.col == endpos.col))
Karsten Hopp 74c289
  		    {
Karsten Hopp 74c289
*** ../vim-7.3.876/src/testdir/test14.in	2013-03-19 15:27:43.000000000 +0100
Karsten Hopp 74c289
--- src/testdir/test14.in	2013-04-03 20:59:14.000000000 +0200
Karsten Hopp 74c289
***************
Karsten Hopp 74c289
*** 44,49 ****
Karsten Hopp 74c289
--- 44,52 ----
Karsten Hopp 74c289
  :call append(line('$'), line('.') - startline)
Karsten Hopp 74c289
  :call search('^$', 'bc')
Karsten Hopp 74c289
  :call append(line('$'), line('.') - startline)
Karsten Hopp 74c289
+ /two
Karsten Hopp 74c289
+ :call search('.', 'c')
Karsten Hopp 74c289
+ :call append(line('$'), getline('.')[col('.') - 1:])
Karsten Hopp 74c289
  :/^search()/,$w >>test.out
Karsten Hopp 74c289
  :qa!
Karsten Hopp 74c289
  ENDTEST
Karsten Hopp 74c289
***************
Karsten Hopp 74c289
*** 79,82 ****
Karsten Hopp 74c289
--- 82,86 ----
Karsten Hopp 74c289
  foobar
Karsten Hopp 74c289
  
Karsten Hopp 74c289
  
Karsten Hopp 74c289
+ one two
Karsten Hopp 74c289
  search()
Karsten Hopp 74c289
*** ../vim-7.3.876/src/testdir/test14.ok	2013-03-19 15:27:43.000000000 +0100
Karsten Hopp 74c289
--- src/testdir/test14.ok	2013-04-03 20:59:14.000000000 +0200
Karsten Hopp 74c289
***************
Karsten Hopp 74c289
*** 19,21 ****
Karsten Hopp 74c289
--- 19,22 ----
Karsten Hopp 74c289
  0
Karsten Hopp 74c289
  1
Karsten Hopp 74c289
  1
Karsten Hopp 74c289
+ two
Karsten Hopp 74c289
*** ../vim-7.3.876/src/version.c	2013-04-03 21:11:33.000000000 +0200
Karsten Hopp 74c289
--- src/version.c	2013-04-03 21:12:50.000000000 +0200
Karsten Hopp 74c289
***************
Karsten Hopp 74c289
*** 730,731 ****
Karsten Hopp 74c289
--- 730,733 ----
Karsten Hopp 74c289
  {   /* Add new patch number below this line */
Karsten Hopp 74c289
+ /**/
Karsten Hopp 74c289
+     877,
Karsten Hopp 74c289
  /**/
Karsten Hopp 74c289
Karsten Hopp 74c289
-- 
Karsten Hopp 74c289
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 74c289
113. You are asked about a bus schedule, you wonder if it is 16 or 32 bits.
Karsten Hopp 74c289
Karsten Hopp 74c289
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 74c289
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 74c289
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 74c289
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///