3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.101
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.101
3ef2ca
Problem:    Using \1 in pattern goes one line too far. (Bohr Shaw, John Little)
3ef2ca
Solution:   Only advance the match end for the matched characters in the last
3ef2ca
	    line.
3ef2ca
Files:	    src/regexp.c, src/testdir/test64.in, src/testdir/test64.ok
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.100/src/regexp.c	2013-09-19 17:03:57.000000000 +0200
3ef2ca
--- src/regexp.c	2013-11-21 16:58:38.000000000 +0100
3ef2ca
***************
3ef2ca
*** 6455,6461 ****
3ef2ca
  /*
3ef2ca
   * Check whether a backreference matches.
3ef2ca
   * Returns RA_FAIL, RA_NOMATCH or RA_MATCH.
3ef2ca
!  * If "bytelen" is not NULL, it is set to the bytelength of the whole match.
3ef2ca
   */
3ef2ca
      static int
3ef2ca
  match_with_backref(start_lnum, start_col, end_lnum, end_col, bytelen)
3ef2ca
--- 6455,6462 ----
3ef2ca
  /*
3ef2ca
   * Check whether a backreference matches.
3ef2ca
   * Returns RA_FAIL, RA_NOMATCH or RA_MATCH.
3ef2ca
!  * If "bytelen" is not NULL, it is set to the byte length of the match in the
3ef2ca
!  * last line.
3ef2ca
   */
3ef2ca
      static int
3ef2ca
  match_with_backref(start_lnum, start_col, end_lnum, end_col, bytelen)
3ef2ca
***************
3ef2ca
*** 6511,6516 ****
3ef2ca
--- 6512,6519 ----
3ef2ca
  
3ef2ca
  	/* Advance to next line. */
3ef2ca
  	reg_nextline();
3ef2ca
+ 	if (bytelen != NULL)
3ef2ca
+ 	    *bytelen = 0;
3ef2ca
  	++clnum;
3ef2ca
  	ccol = 0;
3ef2ca
  	if (got_int)
3ef2ca
*** ../vim-7.4.100/src/testdir/test64.in	2013-11-21 16:03:35.000000000 +0100
3ef2ca
--- src/testdir/test64.in	2013-11-21 16:56:20.000000000 +0100
3ef2ca
***************
3ef2ca
*** 507,512 ****
3ef2ca
--- 507,514 ----
3ef2ca
  :" Check a pattern with a line break and ^ and $
3ef2ca
  :call add(tl, [2, 'a\n^b$\n^c', ['a', 'b', 'c'], ['XX']])
3ef2ca
  :"
3ef2ca
+ :call add(tl, [2, '\(^.\+\n\)\1', [' dog', ' dog', 'asdf'], ['XXasdf']])
3ef2ca
+ :"
3ef2ca
  :"""" Run the multi-line tests
3ef2ca
  :"
3ef2ca
  :$put ='multi-line tests'
3ef2ca
*** ../vim-7.4.100/src/testdir/test64.ok	2013-11-21 16:03:35.000000000 +0100
3ef2ca
--- src/testdir/test64.ok	2013-11-21 16:57:41.000000000 +0100
3ef2ca
***************
3ef2ca
*** 1031,1036 ****
3ef2ca
--- 1031,1039 ----
3ef2ca
  OK 0 - a\n^b$\n^c
3ef2ca
  OK 1 - a\n^b$\n^c
3ef2ca
  OK 2 - a\n^b$\n^c
3ef2ca
+ OK 0 - \(^.\+\n\)\1
3ef2ca
+ OK 1 - \(^.\+\n\)\1
3ef2ca
+ OK 2 - \(^.\+\n\)\1
3ef2ca
  
3ef2ca
  <T="5">Ta 5</Title>
3ef2ca
  <T="7">Ac 7</Title>
3ef2ca
*** ../vim-7.4.100/src/version.c	2013-11-21 16:03:35.000000000 +0100
3ef2ca
--- src/version.c	2013-11-21 16:44:00.000000000 +0100
3ef2ca
***************
3ef2ca
*** 740,741 ****
3ef2ca
--- 740,743 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     101,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
The budget process was invented by an alien race of sadistic beings who
3ef2ca
resemble large cats.
3ef2ca
				(Scott Adams - The Dilbert principle)
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///