void (TextAttributes attributes, boolean atBreak, boolean beforeBreak) { boolean isInSelection = isInSelection(atBreak); boolean isInCaretRow = isInCaretRow(!myReverseIteration && (!atBreak || !beforeBreak), myReverseIteration || (atBreak && beforeBreak)); boolean isInGuardedBlock = false; if (!myUseOnlyFullLineHighlighters) { RangeMarker guard = myDocument.getOffsetGuard(myReverseIteration ? myStartOffset - 1 : myStartOffset); isInGuardedBlock = guard != null && (!atBreak || myReverseIteration ? guard.getEndOffset() > myStartOffset : guard.getStartOffset() < myStartOffset); } TextAttributes syntax = myHighlighterIterator == null || myHighlighterIterator.atEnd() ? null : (atBreak && myStartOffset == (myReverseIteration ? myHighlighterIterator.getEnd() : myHighlighterIterator.getStart())) ? null : myHighlighterIterator.getTextAttributes(); TextAttributes selection = isInSelection ? mySelectionAttributes : null; TextAttributes caret = isInCaretRow ? myCaretRowAttributes : null; TextAttributes fold = myCurrentFold != null ? myFoldTextAttributes : null; TextAttributes guard = isInGuardedBlock ? new TextAttributes(null, myReadOnlyColor, null, EffectType.BOXED, Font.PLAIN) : null; final int size = myCurrentHighlighters.size(); if (size > 1) { ContainerUtil.quickSort(myCurrentHighlighters, createByLayerThenByAttributesComparator(myEditor.getColorsScheme())); } for (int i = 0; i < size; i++) { RangeHighlighterEx highlighter = myCurrentHighlighters.get(i); if (highlighter.getTextAttributes(myEditor.getColorsScheme()) == TextAttributes.ERASE_MARKER) { syntax = null; } } List<TextAttributes> cachedAttributes = myCachedAttributesList; if (!cachedAttributes.isEmpty()) cachedAttributes.clear(); for (int i = 0; i < size; i++) { RangeHighlighterEx highlighter = myCurrentHighlighters.get(i); if (atBreak && highlighter.getTargetArea() == HighlighterTargetArea.EXACT_RANGE && myStartOffset == (myReverseIteration ? highlighter.getEndOffset() : highlighter.getStartOffset())) continue; if (highlighter.getLayer() < HighlighterLayer.SELECTION) { if (selection != null) { cachedAttributes.add(selection); selection = null; } } if (fold != null && highlighter.getLayer() < HighlighterLayer.GUARDED_BLOCKS) { cachedAttributes.add(fold); fold = null; } if (guard != null && highlighter.getLayer() < HighlighterLayer.GUARDED_BLOCKS) { cachedAttributes.add(guard); guard = null; } if (caret != null && highlighter.getLayer() < HighlighterLayer.CARET_ROW) { cachedAttributes.add(caret); caret = null; } if (syntax != null && highlighter.getLayer() < HighlighterLayer.SYNTAX) { cachedAttributes.add(syntax); syntax = null; } TextAttributes textAttributes = highlighter.getTextAttributes(myEditor.getColorsScheme()); if (textAttributes != null && textAttributes != TextAttributes.ERASE_MARKER) { cachedAttributes.add(textAttributes); } } if (selection != null) cachedAttributes.add(selection); if (fold != null) cachedAttributes.add(fold); if (guard != null) cachedAttributes.add(guard); if (caret != null) cachedAttributes.add(caret); if (syntax != null) cachedAttributes.add(syntax); Color fore = null; Color back = isInGuardedBlock ? myReadOnlyColor : null; @JdkConstants.FontStyle int fontType = Font.PLAIN; TextAttributesEffectsBuilder effectsBuilder = null; for (int i = 0; i < cachedAttributes.size(); i++) { TextAttributes attrs = cachedAttributes.get(i); if (fore == null) { fore = attrs.getForegroundColor(); } if (back == null) { back = attrs.getBackgroundColor(); } if (fontType == Font.PLAIN) { fontType = attrs.getFontType(); } if (attrs.hasEffects()) { if (effectsBuilder == null) { effectsBuilder = TextAttributesEffectsBuilder.create(); } effectsBuilder.slipUnder(attrs); } } if (fore == null) fore = myDefaultForeground; if (back == null) back = myDefaultBackground; if (fontType == Font.PLAIN) fontType = myDefaultFontType; attributes.setAttributes(fore, back, null, null, null, fontType); if (effectsBuilder != null) { effectsBuilder.applyTo(attributes); } }