diff options
author | Zufu Liu <unknown> | 2023-12-21 16:00:00 +1100 |
---|---|---|
committer | Zufu Liu <unknown> | 2023-12-21 16:00:00 +1100 |
commit | 8e55cc0c973cc2fbaac8cca1505524b86ce58dff (patch) | |
tree | 0cf01d056b0c92de62b811466495a42d82a7879b /src/Document.cxx | |
parent | 1b153f8d8d4b2f09afc2d039256c958e94bd3b05 (diff) | |
download | scintilla-mirror-8e55cc0c973cc2fbaac8cca1505524b86ce58dff.tar.gz |
Bug [#2405]. Avoid character fragments in regular expression search results.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r-- | src/Document.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index d67cac25e..aea2cfd0b 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2883,6 +2883,9 @@ public: else return pdoc->CharAt(index); } + Sci::Position MovePositionOutsideChar(Sci::Position pos, Sci::Position moveDir) const noexcept override { + return pdoc->MovePositionOutsideChar(pos, moveDir, false); + } }; #ifndef NO_CXX11_REGEX @@ -3277,8 +3280,7 @@ Sci::Position BuiltinRegex::FindText(Document *doc, Sci::Position minPos, Sci::P search.SetLineRange(lineStartPos, lineEndPos); int success = search.Execute(di, startOfLine, endOfLine); if (success) { - // Ensure only whole characters selected - Sci::Position endPos = doc->MovePositionOutsideChar(search.eopat[0], 1, false); + Sci::Position endPos = search.eopat[0]; // There can be only one start of a line, so no need to look for last match in line if ((resr.increment == -1) && !searchforLineStart) { // Check for the last match on this line. @@ -3292,14 +3294,13 @@ Sci::Position BuiltinRegex::FindText(Document *doc, Sci::Position minPos, Sci::P } success = search.Execute(di, pos, endOfLine); if (success) { - endPos = doc->MovePositionOutsideChar(search.eopat[0], 1, false); + endPos = search.eopat[0]; } else { search.bopat = bopat; search.eopat = eopat; } } } - search.eopat[0] = endPos; pos = search.bopat[0]; lenRet = endPos - pos; break; |