void (Graphics g, Rectangle clip) { int lineHeight = getLineHeight(); int visibleLineNumber = clip.y / lineHeight; int startLineNumber = xyToLogicalPosition(new Point(0, clip.y)).line; if (startLineNumber >= myDocument.getLineCount() || startLineNumber < 0) { return; } int start = myDocument.getLineStartOffset(startLineNumber); IterationState iterationState = new IterationState(this, start, true); LineIterator lIterator = createLineIterator(); lIterator.start(start); if (lIterator.atEnd()) { return; } TextAttributes attributes = iterationState.getMergedAttributes(); Color currentColor = attributes.getForegroundColor(); if (currentColor == null) { currentColor = Color.black; } Color effectColor = attributes.getEffectColor(); EffectType effectType = attributes.getEffectType(); int fontType = attributes.getFontType(); myCurrentFontType = fontType; Font currentFont = getFont(fontType); g.setColor(currentColor); g.setFont(currentFont); Point position = new Point(0, visibleLineNumber * lineHeight); while (!iterationState.atEnd() && !lIterator.atEnd()) { int hEnd = iterationState.getEndOffset(); int lEnd = lIterator.getEnd(); if (hEnd >= lEnd) { FoldRegion collapsedFolderAt = myFoldingModel.getCollapsedRegionAtOffset(start); if (collapsedFolderAt == null) { drawString(g, start, lEnd - lIterator.getSeparatorLength(), position, clip, effectColor, effectType, fontType, currentColor); position.x = 0; if (position.y > clip.y + clip.height) break; position.y += lineHeight; start = lEnd; } // myBorderEffect.eolReached(g, this); lIterator.advance(); } else { FoldRegion collapsedFolderAt = iterationState.getCurrentFold(); if (collapsedFolderAt != null) { int foldingXStart = position.x; position.x = drawString(g, collapsedFolderAt.getPlaceholderText(), position, clip, effectColor, effectType, fontType, currentColor); BorderEffect.paintFoldedEffect(g, foldingXStart, position.y, position.x, getLineHeight(), effectColor, effectType); } else { if (hEnd > lEnd - lIterator.getSeparatorLength()) { position.x = drawString(g, start, lEnd - lIterator.getSeparatorLength(), position, clip, effectColor, effectType, fontType, currentColor); } else { position.x = drawString(g, start, hEnd, position, clip, effectColor, effectType, fontType, currentColor); } } iterationState.advance(); attributes = iterationState.getMergedAttributes(); Color color = attributes.getForegroundColor(); if (color == null) { color = Color.black; } if (color != currentColor) { g.setColor(color); currentColor = color; } effectColor = attributes.getEffectColor(); effectType = attributes.getEffectType(); fontType = attributes.getFontType(); start = iterationState.getStartOffset(); } } FoldRegion collapsedFolderAt = iterationState.getCurrentFold(); if (collapsedFolderAt != null) { int foldingXStart = position.x; int foldingXEnd = drawString(g, collapsedFolderAt.getPlaceholderText(), position, clip, effectColor, effectType, fontType, currentColor); BorderEffect.paintFoldedEffect(g, foldingXStart, position.y, foldingXEnd, getLineHeight(), effectColor, effectType); // myBorderEffect.collapsedFolderReached(g, this); } flushCachedChars(g); }