From f76d4f14632acb5eb5ff671d97654d4032cbef7e Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 27 Jul 2007 01:52:48 +0000 Subject: Changed lineStates to a SplitVector so that it supports insert and delete so inserting and deleting lines does not cause a really large number of changed values under most circumstances leading to fewer notifications. SVector is no longer used. --- src/SplitVector.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/SplitVector.h') diff --git a/src/SplitVector.h b/src/SplitVector.h index 342be02ad..9d62aef72 100644 --- a/src/SplitVector.h +++ b/src/SplitVector.h @@ -181,6 +181,14 @@ public: gapLength -= insertLength; } } + + /// Ensure at least length elements allocated, + /// appending zero valued elements if needed. + void EnsureLength(int wantedLength) { + if (Length() < wantedLength) { + InsertValue(Length(), wantedLength - Length(), 0); + } + } /// Insert text into the buffer from an array. void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) { -- cgit v1.2.3