Graphics2D g2d = (Graphics2D)g;
host = (RSyntaxTextArea)getContainer();
int ascent = host.getMaxAscent();
int fontHeight = host.getLineHeight();
FoldManager fm = host.getFoldManager();
int n = getViewCount(); // Number of lines.
int x = alloc.x + getLeftInset();
tempRect.y = alloc.y + getTopInset();
Rectangle clip = g.getClipBounds();
for (int i = 0; i < n; i++) {
tempRect.x = x + getOffset(X_AXIS, i);
//tempRect.y = y + getOffset(Y_AXIS, i);
tempRect.width = getSpan(X_AXIS, i);
tempRect.height = getSpan(Y_AXIS, i);
//System.err.println("For line " + i + ": tempRect==" + tempRect);
if (tempRect.intersects(clip)) {
View view = getView(i);
drawView(g2d, alloc, view, fontHeight, tempRect.y+ascent);
}
tempRect.y += tempRect.height;
Fold possibleFold = fm.getFoldForLine(i);
if (possibleFold!=null && possibleFold.isCollapsed()) {
i += possibleFold.getCollapsedLineCount();
// Visible indicator of collapsed lines
Color c = RSyntaxUtilities.getFoldedLineBottomColor(host);
if (c!=null) {