use of suite.persistent.PerRope.IRopeList in project suite by stupidsing.
the class DevMain method text.
private Text text(IRopeList<Character> text) {
var starts = new IntsBuilder();
var ends = new IntsBuilder();
var p0 = IntMutable.of(-1);
var size = text.size;
IntSink lf = px -> {
starts.append(p0.value() + 1);
ends.append(px);
p0.update(px);
};
for (var p = 0; p < size; p++) {
var ch = text.get.apply(p);
if (ch == '\n' || wrapSize < p - p0.value())
lf.f(p);
}
if (1 < size - p0.value())
lf.f(size);
return new Text(text, starts.toInts().toArray(), ends.toInts().toArray());
}
Aggregations