MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / GapTo

Method GapTo

scintilla/src/SplitVector.h:25–40  ·  view source on GitHub ↗

Move the gap to a particular position so that insertion and deletion at that point will not require much copying and hence be fast.

Source from the content-addressed store, hash-verified

23 /// deletion at that point will not require much copying and
24 /// hence be fast.
25 void GapTo(int position) {
26 if (position != part1Length) {
27 if (position < part1Length) {
28 memmove(
29 body + position + gapLength,
30 body + position,
31 sizeof(T) * (part1Length - position));
32 } else { // position > part1Length
33 memmove(
34 body + part1Length,
35 body + part1Length + gapLength,
36 sizeof(T) * (position - part1Length));
37 }
38 part1Length = position;
39 }
40 }
41
42 /// Check that there is room in the buffer for an insertion,
43 /// reallocating if more space needed.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected