| 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 |
| |
| |
| |
| |
| |
| *** 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) |
| |
| |
| |
| *** 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' |
| |
| |
| |
| *** 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> |
| |
| |
| |
| *** 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 /// |