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