Search in sources :

Example 1 with LineTokenizer

use of com.intellij.openapi.util.text.LineTokenizer in project intellij-community by JetBrains.

the class LineSet method createLineSet.

@NotNull
private static LineSet createLineSet(@NotNull CharSequence text, boolean markModified) {
    TIntArrayList starts = new TIntArrayList();
    TByteArrayList flags = new TByteArrayList();
    LineTokenizer lineTokenizer = new LineTokenizer(text);
    while (!lineTokenizer.atEnd()) {
        starts.add(lineTokenizer.getOffset());
        flags.add((byte) (lineTokenizer.getLineSeparatorLength() | (markModified ? MODIFIED_MASK : 0)));
        lineTokenizer.advance();
    }
    return new LineSet(starts.toNativeArray(), flags.toNativeArray(), text.length());
}
Also used : TByteArrayList(gnu.trove.TByteArrayList) LineTokenizer(com.intellij.openapi.util.text.LineTokenizer) TIntArrayList(gnu.trove.TIntArrayList) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

LineTokenizer (com.intellij.openapi.util.text.LineTokenizer)1 TByteArrayList (gnu.trove.TByteArrayList)1 TIntArrayList (gnu.trove.TIntArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1