summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2013-11-21 17:13:00 +0100
committerBram Moolenaar <bram@vim.org>2013-11-21 17:13:00 +0100
commit3ac2491392f525919a34937b41b53fd6644783f1 (patch)
treec6a0fd38a1cb60a6d29c3aecd9e7a7145b096fa8
parent4fee5522f04e9b6b3d89d35797be5442b074097b (diff)
downloadvim-3ac2491392f525919a34937b41b53fd6644783f1.tar.gz
updated for version 7.4.101v7.4.101v7-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.
-rw-r--r--src/regexp.c5
-rw-r--r--src/testdir/test64.in2
-rw-r--r--src/testdir/test64.ok3
-rw-r--r--src/version.c2
4 files changed, 11 insertions, 1 deletions
diff --git a/src/regexp.c b/src/regexp.c
index 075374d1..f1e8909b 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -6455,7 +6455,8 @@ re_num_cmp(val, scan)
/*
* 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.
+ * 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,6 +6512,8 @@ match_with_backref(start_lnum, start_col, end_lnum, end_col, bytelen)
/* Advance to next line. */
reg_nextline();
+ if (bytelen != NULL)
+ *bytelen = 0;
++clnum;
ccol = 0;
if (got_int)
diff --git a/src/testdir/test64.in b/src/testdir/test64.in
index 77949c51..29bf0b90 100644
--- a/src/testdir/test64.in
+++ b/src/testdir/test64.in
@@ -507,6 +507,8 @@ STARTTEST
:" 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'
diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok
index 4bbc5335..a1498ea5 100644
--- a/src/testdir/test64.ok
+++ b/src/testdir/test64.ok
@@ -1031,6 +1031,9 @@ OK 2 - \<\(\(25\_[0-5]\|2\_[0-4]\_[0-9]\|\_[01]\?\_[0-9]\_[0-9]\?\)\.\)\{3\}\(25
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>
diff --git a/src/version.c b/src/version.c
index ab3711d1..47deb0c4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 101,
+/**/
100,
/**/
99,