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