Insert text into the buffer from an array.
| 191 | |
| 192 | /// Insert text into the buffer from an array. |
| 193 | void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) { |
| 194 | PLATFORM_ASSERT((positionToInsert >= 0) && (positionToInsert <= lengthBody)); |
| 195 | if (insertLength > 0) { |
| 196 | if ((positionToInsert < 0) || (positionToInsert > lengthBody)) { |
| 197 | return; |
| 198 | } |
| 199 | RoomFor(insertLength); |
| 200 | GapTo(positionToInsert); |
| 201 | memmove(body + part1Length, s + positionFrom, sizeof(T) * insertLength); |
| 202 | lengthBody += insertLength; |
| 203 | part1Length += insertLength; |
| 204 | gapLength -= insertLength; |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | /// Delete one element from the buffer. |
| 209 | void Delete(int position) { |