aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2003-03-04 10:53:59 +0000
committernyamatongwe <unknown>2003-03-04 10:53:59 +0000
commit69daddeb2a241af212edca89f6a7422e6f8a5053 (patch)
treeab73038e7420a7a3902f38457b1635d8cb4fc676 /src/Document.cxx
parent3767529b0e6cf365888cb7fe25e4a261116be830 (diff)
downloadscintilla-mirror-69daddeb2a241af212edca89f6a7422e6f8a5053.tar.gz
Patch from Jakub to optionally implement more POSIX compatible regular
expressions. \(..\) changes to (..) Fixes problem where find previous would not find earlier matches on same line.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r--src/Document.cxx36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 20a53b132..a1d5beff6 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -847,7 +847,7 @@ public:
* Has not been tested with backwards DBCS searches yet.
*/
long Document::FindText(int minPos, int maxPos, const char *s,
- bool caseSensitive, bool word, bool wordStart, bool regExp,
+ bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix,
int *length) {
if (regExp) {
if (!pre)
@@ -864,7 +864,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
startPos = MovePositionOutsideChar(startPos, 1, false);
endPos = MovePositionOutsideChar(endPos, 1, false);
- const char *errmsg = pre->Compile(s, *length, caseSensitive);
+ const char *errmsg = pre->Compile(s, *length, caseSensitive, posix);
if (errmsg) {
return -1;
}
@@ -888,16 +888,30 @@ long Document::FindText(int minPos, int maxPos, const char *s,
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
int startOfLine = LineStart(line);
int endOfLine = LineEnd(line);
- if ((increment == 1) && (line == lineRangeStart)) {
- if ((startPos != startOfLine) && (s[0] == '^'))
- continue; // Can't match start of line if start position after start of line
- startOfLine = startPos;
- }
- if ((increment == 1) && (line == lineRangeEnd)) {
- if ((endPos != endOfLine) && (searchEnd == '$'))
- continue; // Can't match end of line if end position before end of line
- endOfLine = endPos;
+ if (increment == 1) {
+ if (line == lineRangeStart) {
+ if ((startPos != startOfLine) && (s[0] == '^'))
+ continue; // Can't match start of line if start position after start of line
+ startOfLine = startPos;
+ }
+ if (line == lineRangeEnd) {
+ if ((endPos != endOfLine) && (searchEnd == '$'))
+ continue; // Can't match end of line if end position before end of line
+ endOfLine = endPos;
+ }
+ } else {
+ if (line == lineRangeEnd) {
+ if ((endPos != startOfLine) && (s[0] == '^'))
+ continue; // Can't match start of line if end position after start of line
+ startOfLine = endPos;
+ }
+ if (line == lineRangeStart) {
+ if ((startPos != endOfLine) && (searchEnd == '$'))
+ continue; // Can't match end of line if start position before end of line
+ endOfLine = startPos;
+ }
}
+
DocumentIndexer di(this, endOfLine);
int success = pre->Execute(di, startOfLine, endOfLine);
if (success) {