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.
/*
* 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)
/* Advance to next line. */
reg_nextline();
+ if (bytelen != NULL)
+ *bytelen = 0;
++clnum;
ccol = 0;
if (got_int)
:" 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'
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>
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 101,
/**/
100,
/**/