diff options
author | nyamatongwe <unknown> | 2001-04-30 03:06:51 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2001-04-30 03:06:51 +0000 |
commit | 8b3ad7c54cd0531f3cafad365433d25bce285e0d (patch) | |
tree | 116346405cdb37886408aa6f7c4b29fcabd08af0 | |
parent | 1bd2d31b3ce8714ddeba3d9825a8a605e55751cf (diff) | |
download | scintilla-mirror-8b3ad7c54cd0531f3cafad365433d25bce285e0d.tar.gz |
When doing regexp searches, start position is moved on from end of line
or between lines.
The last character of the search is found using length in case there are any
nulls in the string.
-rw-r--r-- | src/Document.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index ef9779016..befae4570 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -836,11 +836,14 @@ long Document::FindText(int minPos, int maxPos, const char *s, // Replace: $(\1-\2) int lineRangeStart = LineFromPosition(startPos); int lineRangeEnd = LineFromPosition(endPos); + if ((startPos >= LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd)) { + // the start position is at end of line or between line end characters. + lineRangeStart++; + startPos = LineStart(lineRangeStart); + } int pos = -1; int lenRet = 0; - char searchEnd = '\0'; - if (*s) - searchEnd = s[strlen(s) - 1]; + char searchEnd = s[*length - 1]; if (*length == 1) { // These produce empty selections so nudge them on if needed if (s[0] == '^') { |