| To: vim_dev@googlegroups.com |
| Subject: Patch 7.3.1026 |
| 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.3.1026 |
| Problem: New regexp: pattern that includs a new-line matches too early. |
| (john McGowan) |
| Solution: Do not start searching in the second line. |
| Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok |
| |
| |
| |
| |
| |
| *** 3585,3596 **** |
| |
| } /* for (thislist = thislist; thislist->state; thislist++) */ |
| |
| ! /* The first found match is the leftmost one, but there may be a |
| ! * longer one. Keep running the NFA, but don't start from the |
| ! * beginning. Also, do not add the start state in recursive calls of |
| ! * nfa_regmatch(), because recursive calls should only start in the |
| ! * first position. */ |
| ! if (match == FALSE && start->c == NFA_MOPEN + 0) |
| { |
| #ifdef ENABLE_LOG |
| fprintf(log_fd, "(---) STARTSTATE\n"); |
| --- 3585,3599 ---- |
| |
| } /* for (thislist = thislist; thislist->state; thislist++) */ |
| |
| ! /* Look for the start of a match in the current position by adding the |
| ! * start state to the list of states. |
| ! * The first found match is the leftmost one, thus the order of states |
| ! * matters! |
| ! * Do not add the start state in recursive calls of nfa_regmatch(), |
| ! * because recursive calls should only start in the first position. |
| ! * Also don't start a match past the first line. */ |
| ! if (match == FALSE && start->c == NFA_MOPEN + 0 |
| ! && reglnum == 0 && clen != 0) |
| { |
| #ifdef ENABLE_LOG |
| fprintf(log_fd, "(---) STARTSTATE\n"); |
| |
| |
| |
| *** 372,377 **** |
| --- 372,383 ---- |
| :.+1,.+2yank |
| Gop:" |
| :" |
| + :" Check a pattern with a line break matches in the right position. |
| + /^Multiline |
| + /\S.*\nx |
| + :.yank |
| + y$Gop:" |
| + :" |
| :" |
| :/\%#=1^Results/,$wq! test.out |
| ENDTEST |
| |
| *** 383,386 **** |
| --- 389,399 ---- |
| <T="">Ta 5</Title> |
| <T="">Ac 7</Title> |
| |
| + Multiline: |
| + abc |
| + def |
| + ghi |
| + xjk |
| + lmn |
| + |
| Results of test64: |
| |
| |
| |
| *** 705,707 **** |
| --- 705,708 ---- |
| |
| <T="5">Ta 5</Title> |
| <T="7">Ac 7</Title> |
| + ghi |
| |
| |
| |
| *** 730,731 **** |
| --- 730,733 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 1026, |
| /**/ |
| |
| -- |
| For society, it's probably a good thing that engineers value function over |
| appearance. For example, you wouldn't want engineers to build nuclear power |
| plants that only _look_ like they would keep all the radiation inside. |
| (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 /// |