diff options
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);  } | 
