int line = linesAbove;
//int count = 0;
while (y<clip.y+clip.height+lineHeight && line<lineCount) {
Fold fold = fm.getFoldForLine(line);
Element lineElement = map.getElement(line);
int startOffset = lineElement.getStartOffset();
//int endOffset = (line==lineCount ? lineElement.getEndOffset()-1 :
// lineElement.getEndOffset()-1);
int endOffset = lineElement.getEndOffset()-1; // Why always "-1"?
h.paintLayeredHighlights(g2d, startOffset, endOffset,
a, host, this);
// Paint a line of text.
token = document.getTokenListForLine(line);
drawLine(token, g2d, x,y);
if (fold!=null && fold.isCollapsed()) {
// Visible indicator of collapsed lines
Color c = RSyntaxUtilities.getFoldedLineBottomColor(host);
if (c!=null) {
g.setColor(c);
g.drawLine(x,y+lineHeight-ascent-1,
alloc.width,y+lineHeight-ascent-1);
}
// Skip to next line to paint, taking extra care for lines with
// block ends and begins together, e.g. "} else {"
do {
int hiddenLineCount = fold.getLineCount();
if (hiddenLineCount==0) {
// Fold parser identified a zero-line fold region.
// This is really a bug, but we'll be graceful here
// and avoid an infinite loop.
break;
}
line += hiddenLineCount;
fold = fm.getFoldForLine(line);
} while (fold!=null && fold.isCollapsed());
}
y += lineHeight;
line++;