diff options
Diffstat (limited to 'src/CellBuffer.cxx')
-rw-r--r-- | src/CellBuffer.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 3e9f0e7b7..56dd27ea0 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -597,6 +597,7 @@ CellBuffer::CellBuffer(int initialLength) { part2body = body + gaplen; readOnly = false; collectingUndo = true; + growSize = 4000; } CellBuffer::~CellBuffer() { @@ -627,7 +628,9 @@ void CellBuffer::RoomFor(int insertionLength) { if (gaplen <= insertionLength) { //Platform::DebugPrintf("need room %d %d\n", gaplen, insertionLength); GapTo(length); - int newSize = size + insertionLength + 4000; + if (growSize * 4 < size) + growSize *= 2; + int newSize = size + insertionLength + growSize; //Platform::DebugPrintf("moved gap %d\n", newSize); char *newBody = new char[newSize]; memcpy(newBody, body, size); |