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