diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Document.cxx | 4 | ||||
-rw-r--r-- | src/Document.h | 2 | ||||
-rw-r--r-- | src/PositionCache.cxx | 2 |
3 files changed, 3 insertions, 5 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index 8baa84ad8..eae055dc2 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -1142,9 +1142,7 @@ static constexpr bool IsSpaceOrTab(int ch) noexcept { // 2) Break before punctuation // 3) Break after whole character -int Document::SafeSegment(const char *text, int length, int lengthSegment) const noexcept { - if (length <= lengthSegment) - return length; +int Document::SafeSegment(const char *text, int lengthSegment) const noexcept { int lastSpaceBreak = -1; int lastPunctuationBreak = -1; int lastEncodingAllowedBreak = 0; diff --git a/src/Document.h b/src/Document.h index 402f37c17..897a1270c 100644 --- a/src/Document.h +++ b/src/Document.h @@ -352,7 +352,7 @@ public: bool IsDBCSTrailByteNoExcept(char ch) const noexcept; int DBCSDrawBytes(std::string_view text) const noexcept; bool IsDBCSDualByteAt(Sci::Position pos) const noexcept; - int SafeSegment(const char *text, int length, int lengthSegment) const noexcept; + int SafeSegment(const char *text, int lengthSegment) const noexcept; EncodingFamily CodePageFamily() const noexcept; // Gateways to modifying document diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 6eee26113..63e130429 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -773,7 +773,7 @@ TextSegment BreakFinder::Next() { subBreak = -1; return TextSegment(startSegment, nextBreak - startSegment); } else { - subBreak += pdoc->SafeSegment(&ll->chars[subBreak], nextBreak-subBreak, lengthEachSubdivision); + subBreak += pdoc->SafeSegment(&ll->chars[subBreak], lengthEachSubdivision); if (subBreak >= nextBreak) { subBreak = -1; return TextSegment(startSegment, nextBreak - startSegment); |