MCPcopy Create free account
hub / github.com/cxasm/notepad-- / InsertSpace

Method InsertSpace

src/qscint/scintilla/src/SparseVector.h:90–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88 }
89 }
90 void InsertSpace(Sci::Position position, Sci::Position insertLength) {
91 assert(position <= Length()); // Only operation that works at end.
92 const Sci::Position partition = starts->PartitionFromPosition(position);
93 const Sci::Position startPartition = starts->PositionFromPartition(partition);
94 if (startPartition == position) {
95 const bool positionOccupied = values->ValueAt(partition) != T();
96 // Inserting at start of run so make previous longer
97 if (partition == 0) {
98 // Inserting at start of document so ensure start empty
99 if (positionOccupied) {
100 starts->InsertPartition(1, 0);
101 values->InsertEmpty(0, 1);
102 }
103 starts->InsertText(partition, insertLength);
104 } else {
105 if (positionOccupied) {
106 starts->InsertText(partition - 1, insertLength);
107 } else {
108 // Insert at end of run so do not extend style
109 starts->InsertText(partition, insertLength);
110 }
111 }
112 } else {
113 starts->InsertText(partition, insertLength);
114 }
115 }
116 void DeletePosition(Sci::Position position) {
117 assert(position < Length());
118 Sci::Position partition = starts->PartitionFromPosition(position);

Callers

nothing calls this directly

Calls 7

TFunction · 0.85
PartitionFromPositionMethod · 0.80
PositionFromPartitionMethod · 0.80
InsertPartitionMethod · 0.80
InsertEmptyMethod · 0.80
ValueAtMethod · 0.45
InsertTextMethod · 0.45

Tested by

no test coverage detected