aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/CellBuffer.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2020-05-19 13:23:04 +1000
committerNeil <nyamatongwe@gmail.com>2020-05-19 13:23:04 +1000
commit9b9c12efef67a4f327f298e36a75b19d97a4735a (patch)
tree49fc22e6bb2cfaacd2ebb63b6b5e033334b11b34 /src/CellBuffer.cxx
parentac2e28f9de128de48e1b43ca96bb8baa6d7aba41 (diff)
downloadscintilla-mirror-9b9c12efef67a4f327f298e36a75b19d97a4735a.tar.gz
Backport: Encapsulate common check for PS, LS, and NEL as UTF8IsMultibyteLineEnd.
Avoids construction of temporary array. Backport of changeset 8242:0a852c639c21.
Diffstat (limited to 'src/CellBuffer.cxx')
-rw-r--r--src/CellBuffer.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index 51264966d..cbc19f539 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -734,8 +734,7 @@ bool CellBuffer::ContainsLineEnd(const char *s, Sci::Position length) const noex
if ((ch == '\r') || (ch == '\n')) {
return true;
} else if (utf8LineEnds) {
- const unsigned char back3[3] = { chBeforePrev, chPrev, ch };
- if (UTF8IsSeparator(back3) || UTF8IsNEL(back3 + 1)) {
+ if (UTF8IsMultibyteLineEnd(chBeforePrev, chPrev, ch)) {
return true;
}
}
@@ -907,8 +906,7 @@ void CellBuffer::ResetLineEnds() {
lineInsert++;
}
} else if (utf8LineEnds) {
- const unsigned char back3[3] = {chBeforePrev, chPrev, ch};
- if (UTF8IsSeparator(back3) || UTF8IsNEL(back3+1)) {
+ if (UTF8IsMultibyteLineEnd(chBeforePrev, chPrev, ch)) {
InsertLine(lineInsert, (position + i) + 1, atLineStart);
lineInsert++;
}
@@ -1081,8 +1079,7 @@ void CellBuffer::BasicInsertString(Sci::Position position, const char *s, Sci::P
InsertLine(lineInsert, (position + ptr - s), atLineStart);
lineInsert++;
} else if (utf8LineEnds && !UTF8IsAscii(ch)) {
- const unsigned char back3[3] = { chBeforePrev, chPrev, ch };
- if (UTF8IsSeparator(back3) || UTF8IsNEL(back3 + 1)) {
+ if (UTF8IsMultibyteLineEnd(chBeforePrev, chPrev, ch)) {
InsertLine(lineInsert, (position + ptr - s), atLineStart);
lineInsert++;
}