From 50eca9beb97b7c69f15d1ce96dddb5e2efc3a0e8 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 13 Apr 2018 08:48:23 +1000 Subject: 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. --- src/Document.cxx | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/Document.cxx b/src/Document.cxx index 3b70432e3..b3b445b02 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2533,25 +2533,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(doc->LineFromPosition(startPos)); lineRangeEnd = static_cast(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(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(doc->LineEnd(lineRangeStart)); - } lineRangeBreak = lineRangeEnd + increment; } Range LineRange(Sci::Line line) const { -- cgit v1.2.3