aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMarko Njezic <devnull@localhost>2011-06-08 14:59:43 +0200
committerMarko Njezic <devnull@localhost>2011-06-08 14:59:43 +0200
commit695428bac032192609f23dfcdab55a2ee79b4bb0 (patch)
treec226110e940a84467c94c9c39908fc530c9639aa /src
parent8bdb4e9f566a8aeb8b691c77ecabd25b61e617df (diff)
downloadscintilla-mirror-695428bac032192609f23dfcdab55a2ee79b4bb0.tar.gz
Fix regex search on the last line of search range
when search pattern ends with escaped $ modifier. Bug #3313746.
Diffstat (limited to 'src')
-rw-r--r--src/Document.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 7b718f272..dde9c4b6b 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -2113,6 +2113,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
int pos = -1;
int lenRet = 0;
char searchEnd = s[*length - 1];
+ char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0';
int lineRangeBreak = lineRangeEnd + increment;
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
int startOfLine = doc->LineStart(line);
@@ -2124,7 +2125,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
startOfLine = startPos;
}
if (line == lineRangeEnd) {
- if ((endPos != endOfLine) && (searchEnd == '$'))
+ if ((endPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\'))
continue; // Can't match end of line if end position before end of line
endOfLine = endPos;
}
@@ -2135,7 +2136,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
startOfLine = endPos;
}
if (line == lineRangeStart) {
- if ((startPos != endOfLine) && (searchEnd == '$'))
+ if ((startPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\'))
continue; // Can't match end of line if start position before end of line
endOfLine = startPos;
}