while (y<visibleRect.y+visibleRect.height+ascent && line<=textArea.getLineCount()) {
String number = Integer.toString(line + getLineNumberingStartIndex() - 1);
int width = metrics.stringWidth(number);
g.drawString(number, rhs-width,y);
y += cellHeight;
Fold fold = fm.getFoldForLine(line-1);
// Skip to next line to paint, taking extra care for lines with
// block ends and begins together, e.g. "} else {"
while (fold!=null && fold.isCollapsed()) {
int hiddenLineCount = fold.getLineCount();
if (hiddenLineCount==0) {
// Fold parser identified a 0-line fold region... This
// is really a bug, but we'll handle it gracefully.
break;
}
line += hiddenLineCount;
fold = fm.getFoldForLine(line-1);
}
line++;
}
}
else { // rtl
int line = topLine + 1;
while (y<visibleRect.y+visibleRect.height && line<textArea.getLineCount()) {
String number = Integer.toString(line + getLineNumberingStartIndex() - 1);
g.drawString(number, RHS_BORDER_WIDTH, y);
y += cellHeight;
Fold fold = fm.getFoldForLine(line-1);
// Skip to next line to paint, taking extra care for lines with
// block ends and begins together, e.g. "} else {"
while (fold!=null && fold.isCollapsed()) {
line += fold.getLineCount();
fold = fm.getFoldForLine(line);
}
line++;
}
}