getVisibleLength method
Calculates the visible length starting from startX.
Implementation
int getVisibleLength({final int startX = 0}) {
var length = 0;
var currentPos = startX;
for (final segment in segments) {
for (final char in segment.text.characters) {
if (char == '\t') {
final advance = 8 - (currentPos % 8);
length += advance;
currentPos += advance;
} else {
final advance = isWide(char) ? 2 : 1;
length += advance;
currentPos += advance;
}
}
}
return length;
}