diff options
author | Neil <nyamatongwe@gmail.com> | 2015-12-31 14:28:37 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2015-12-31 14:28:37 +1100 |
commit | 1ea05a3df97f9a733254ecde9e70b5827083b8e6 (patch) | |
tree | ccf99b9eb15493d3108d9d8c031c0719c4514914 /src/CellBuffer.cxx | |
parent | ba6468fb9aca4f448eba0024b96d1bb3ec213720 (diff) | |
download | scintilla-mirror-1ea05a3df97f9a733254ecde9e70b5827083b8e6.tar.gz |
Treat Unicode line ends like common line ends when maintaining fold state.
Diffstat (limited to 'src/CellBuffer.cxx')
-rw-r--r-- | src/CellBuffer.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index f43a0c302..6ad990a63 100644 --- a/src/CellBuffer.cxx +++ b/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); } |