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