ansiTake method
ANSI aware take variant. Includes all ANSI sequences without counting
them towards count
.
Implementation
String ansiTake(int count) {
var at = 0;
final it = StringBuffer();
while (ansiStripped(it.toString()).length < count) {
var match = ansiMatcher.matchAsPrefix(this, at);
if (match != null) {
it.write(match.group(0));
at = match.end;
} else {
it.write(this[at]);
at++;
}
}
return it.toString();
}