diff options
Diffstat (limited to 'src/CellBuffer.cxx')
-rw-r--r-- | src/CellBuffer.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 375fe2201..f02d5348a 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -642,6 +642,21 @@ Sci::Position CellBuffer::GapPosition() const noexcept { return substance.GapPosition(); } +SplitView CellBuffer::AllView() const noexcept { + const size_t length = substance.Length(); + size_t length1 = substance.GapPosition(); + if (length1 == 0) { + // Assign segment2 to segment1 / length1 to avoid useless test against 0 length1 + length1 = length; + } + return SplitView { + substance.ElementPointer(0), + length1, + substance.ElementPointer(length1) - length1, + length + }; +} + // The char* returned is to an allocation owned by the undo history const char *CellBuffer::InsertString(Sci::Position position, const char *s, Sci::Position insertLength, bool &startSequence) { // InsertString and DeleteChars are the bottleneck though which all changes occur |