diff options
author | Neil <nyamatongwe@gmail.com> | 2018-04-13 08:48:23 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-04-13 08:48:23 +1000 |
commit | 908a138a46e39a39bb1a4aa1fcdab9a3432c0c3b (patch) | |
tree | 424f6e03ef3cef9de41b02de1108253a56b3bb55 /src/Document.cxx | |
parent | 2c2e5fab6110b483459236ae1320decc5b138cbc (diff) | |
download | scintilla-mirror-908a138a46e39a39bb1a4aa1fcdab9a3432c0c3b.tar.gz |
Backport: Fix bug with regular expression searches failing to match at line start or end.
This was a work-around for infinite loops when replacing empty matches and this
is now the application's responsibility.
Backport of changeset 6683:bcae0331720b.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r-- | src/Document.cxx | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 1d77f7065..1c9b1ceda 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2537,25 +2537,13 @@ public: RESearchRange(const Document *doc_, Sci::Position minPos, Sci::Position maxPos) : doc(doc_) { increment = (minPos <= maxPos) ? 1 : -1; - // Range endpoints should not be inside DBCS characters, but just in case, move them. - startPos = doc->MovePositionOutsideChar(minPos, 1, false); - endPos = doc->MovePositionOutsideChar(maxPos, 1, false); + // Range endpoints should not be inside DBCS characters or between a CR and LF, + // but just in case, move them. + startPos = doc->MovePositionOutsideChar(minPos, 1, true); + endPos = doc->MovePositionOutsideChar(maxPos, 1, true); lineRangeStart = static_cast<Sci::Line>(doc->LineFromPosition(startPos)); lineRangeEnd = static_cast<Sci::Line>(doc->LineFromPosition(endPos)); - if ((increment == 1) && - (startPos >= doc->LineEnd(lineRangeStart)) && - (lineRangeStart < lineRangeEnd)) { - // the start position is at end of line or between line end characters. - lineRangeStart++; - startPos = static_cast<Sci::Position>(doc->LineStart(lineRangeStart)); - } else if ((increment == -1) && - (startPos <= doc->LineStart(lineRangeStart)) && - (lineRangeStart > lineRangeEnd)) { - // the start position is at beginning of line. - lineRangeStart--; - startPos = static_cast<Sci::Position>(doc->LineEnd(lineRangeStart)); - } lineRangeBreak = lineRangeEnd + increment; } Range LineRange(Sci::Line line) const { |