diff options
author | nyamatongwe <devnull@localhost> | 2011-04-27 13:54:49 +1000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2011-04-27 13:54:49 +1000 |
commit | e0e8016abe5d9fc0bfaecaa81662e40e1e83a3d6 (patch) | |
tree | 1093f0f9824a8ee03322e47df4945abc0a1c5af3 /src | |
parent | 39339a63de1d4c410a00b513d3fe9abc58c53117 (diff) | |
download | scintilla-mirror-e0e8016abe5d9fc0bfaecaa81662e40e1e83a3d6.tar.gz |
Fixes for backwards regex search. Bug #3292659.
From Marko Njezic.
Diffstat (limited to 'src')
-rw-r--r-- | src/Document.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index eb818b515..08bc24ecf 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2054,6 +2054,12 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s // the start position is at end of line or between line end characters. lineRangeStart++; startPos = doc->LineStart(lineRangeStart); + } else if ((increment == -1) && + (startPos <= doc->LineStart(lineRangeStart)) && + (lineRangeStart > lineRangeEnd)) { + // the start position is at beginning of line. + lineRangeStart--; + startPos = doc->LineEnd(lineRangeStart); } int pos = -1; int lenRet = 0; @@ -2091,7 +2097,8 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s if (success) { pos = search.bopat[0]; lenRet = search.eopat[0] - search.bopat[0]; - if (increment == -1) { + // There can be only one start of a line, so no need to look for last match in line + if ((increment == -1) && (s[0] != '^')) { // Check for the last match on this line. int repetitions = 1000; // Break out of infinite loop while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) { |