aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2011-04-27 13:54:49 +1000
committernyamatongwe <unknown>2011-04-27 13:54:49 +1000
commit47b7ed9acd76f829028772d6174fcc6a6396b2f1 (patch)
treeba2ea769e988e5afc75c6e2660ef9111a6433961 /src
parent9512f57c6bd843b171b3f8a64d00ed5b1ab0089a (diff)
downloadscintilla-mirror-47b7ed9acd76f829028772d6174fcc6a6396b2f1.tar.gz
Fixes for backwards regex search. Bug #3292659.
From Marko Njezic.
Diffstat (limited to 'src')
-rw-r--r--src/Document.cxx9
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--)) {