diff options
Diffstat (limited to 'scintilla/src/CellBuffer.cxx')
-rw-r--r-- | scintilla/src/CellBuffer.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scintilla/src/CellBuffer.cxx b/scintilla/src/CellBuffer.cxx index e9f8779..653feb7 100644 --- a/scintilla/src/CellBuffer.cxx +++ b/scintilla/src/CellBuffer.cxx @@ -496,6 +496,25 @@ void CellBuffer::SetLineEndTypes(int utf8LineEnds_) { }
}
+bool CellBuffer::ContainsLineEnd(const char *s, int length) const {
+ unsigned char chBeforePrev = 0;
+ unsigned char chPrev = 0;
+ for (int i = 0; i < length; i++) {
+ const unsigned char ch = s[i];
+ if ((ch == '\r') || (ch == '\n')) {
+ return true;
+ } else if (utf8LineEnds) {
+ unsigned char back3[3] = { chBeforePrev, chPrev, ch };
+ if (UTF8IsSeparator(back3) || UTF8IsNEL(back3 + 1)) {
+ return true;
+ }
+ }
+ chBeforePrev = chPrev;
+ chPrev = ch;
+ }
+ return false;
+}
+
void CellBuffer::SetPerLine(PerLine *pl) {
lv.SetPerLine(pl);
}
|