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
commit24b9ab288ebb48fb4cd7efc0fd6a409f50964664 (patch)
tree0126e94199c95d13dc2921f6dc2ab6fbe43e5a18 /src/CellBuffer.cxx
parent39eb66f3627b925e4591d3aeb735120b93b0022c (diff)
downloadscintilla-mirror-24b9ab288ebb48fb4cd7efc0fd6a409f50964664.tar.gz
Encapsulate common check for PS, LS, and NEL as UTF8IsMultibyteLineEnd.
Avoids construction of temporary array.
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 4298cf7d5..877a2c46f 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -735,8 +735,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;
}
}
@@ -908,8 +907,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++;
}
@@ -1083,8 +1081,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++;
}