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 | 6e8f80c1ac63d0d25cf9e6a0daca1302b1824722 (patch) | |
| tree | 4a409b9c8af30fc3e7cd33980ff4eb312060f6b3 /src/CellBuffer.cxx | |
| parent | b31849f9dc2def21e4a0055d18130d99fc18f395 (diff) | |
| download | scintilla-mirror-6e8f80c1ac63d0d25cf9e6a0daca1302b1824722.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);  } | 
