public TextBuffer NewLine(long newLineSize = ResizeColumnDelta, long howManyLines = 1) { BufferLine[] tmp = new BufferLine[_buffer.LongLength + howManyLines]; BufferLine newLine; if (_pos.Column < _buffer[_pos.Line].TextLength) { newLine = new BufferLine(_buffer[_pos.Line].TextLength - _pos.Column + newLineSize); newLine.CopyFrom(_buffer[_pos.Line], 0, _pos.Column); _buffer[_pos.Line].Erase(_pos.Column); } else { newLine = new BufferLine(newLineSize); } long l, dl; for (l = 0; l <= _pos.Line && l < _buffer.LongLength; ++l) { tmp[l] = _buffer[l]; } for (dl = 0; dl < howManyLines; ++dl) { tmp[l + dl] = newLine; } for (; l < _buffer.LongLength; ++l) { tmp[l + dl] = _buffer[l]; } _buffer = tmp; return(this); }
public void CopyTo(BufferLine destination, long dstIndex, long srcIndex = 0L) { destination.CopyFrom(this, dstIndex, srcIndex); }