Removing TextEditor from strings for now

This commit is contained in:
IlushaShurupov 2023-07-15 10:03:16 +03:00
parent eb9210de1c
commit d362d8c3b3
7 changed files with 65 additions and 1049 deletions

View file

@ -170,5 +170,24 @@ namespace tp {
}
return true;
}
static void calcLineOffsets(const tChar* aBuff, Index aLength, Buffer<Index>& aOut) {
halni lines = 0;
for (auto idx : Range(aLength)) {
if (isNewLineChar(aBuff[idx])) {
lines++;
}
}
aOut.reserve(lines + 2); // plus start and end offsets
lines = 0;
for (auto idx : Range(aLength)) {
if (isNewLineChar(aBuff[idx])) {
aOut[lines + 1] = Index(idx + 1);
lines++;
}
}
aOut[0] = 0;
aOut[lines + 1] = aLength;
}
};
}