]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.101 v7.4.101
authorBram Moolenaar <Bram@vim.org>
Thu, 21 Nov 2013 16:13:00 +0000 (17:13 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 21 Nov 2013 16:13:00 +0000 (17:13 +0100)
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.

src/regexp.c
src/testdir/test64.in
src/testdir/test64.ok
src/version.c

index 075374d16bbc8a34f92b5c8affc0cd89caedfbbe..f1e8909b2a959c0bd7b7358acddb89bd41f93e11 100644 (file)
@@ -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)
index 77949c5141086a1778f80deb22da692c46ca78ec..29bf0b902b14383a7d837277cddbe6d4106aa85b 100644 (file)
@@ -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'
index 4bbc5335dc8b4f906d6f6b10b740668857c42701..a1498ea5d69ea6e7856ede495686e13477b62e83 100644 (file)
@@ -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>
index ab3711d102cf16452ae631856dfb1ca88c6df727..47deb0c43ee52429b33113983f3125b023fe0d55 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    101,
 /**/
     100,
 /**/