void (@NotNull Graphics g, int startOffset, int endOffset) { Queue<PositionedStripe> thinEnds = new PriorityQueue<>(5, Comparator.comparingInt(o -> o.yEnd)); Queue<PositionedStripe> wideEnds = new PriorityQueue<>(5, Comparator.comparingInt(o -> o.yEnd)); // sorted by layer List<PositionedStripe> thinStripes = new ArrayList<>(); // layer desc List<PositionedStripe> wideStripes = new ArrayList<>(); // layer desc int[] thinYStart = new int[1]; // in range 0...yStart all spots are drawn int[] wideYStart = new int[1]; // in range 0...yStart all spots are drawn MarkupIterator<RangeHighlighterEx> iterator = myErrorStripeMarkersModel.highlighterIterator(startOffset, endOffset); try { ContainerUtil.process(iterator, highlighter -> { boolean isThin = highlighter.isThinErrorStripeMark(); int[] yStart = isThin ? thinYStart : wideYStart; List<PositionedStripe> stripes = isThin ? thinStripes : wideStripes; Queue<PositionedStripe> ends = isThin ? thinEnds : wideEnds; ProperTextRange range = offsetsToYPositions(highlighter.getStartOffset(), highlighter.getEndOffset()); int ys = range.getStartOffset(); int ye = range.getEndOffset(); if (ye - ys < getMinMarkHeight()) ye = ys + getMinMarkHeight(); yStart[0] = drawStripesEndingBefore(ys, ends, stripes, g, yStart[0]); int layer = highlighter.getLayer(); PositionedStripe stripe = null; int i; for (i = 0; i < stripes.size(); i++) { PositionedStripe s = stripes.get(i); if (s.layer == layer) { stripe = s; break; } if (s.layer < layer) { break; } } EditorColorsScheme colorsScheme = myEditor.getColorsScheme(); Color color = highlighter.getErrorStripeMarkColor(colorsScheme); if (color == null) { if (reportErrorStripeInconsistency) { reportErrorStripeInconsistency = false; LOG.error("Error stripe marker has no color. highlighter: " + highlighter + ", color scheme: " + colorsScheme + " (" + colorsScheme.getClass() + ")"); } return true; } if (stripe == null) { // started new stripe, draw previous above if (i == 0 && yStart[0] != ys) { if (!stripes.isEmpty()) { PositionedStripe top = stripes.get(0); drawSpot(g, top.thin, yStart[0], ys, top.color); } yStart[0] = ys; } stripe = new PositionedStripe(color, ye, isThin, layer); stripes.add(i, stripe); ends.offer(stripe); } else { if (stripe.yEnd < ye) { if (!color.equals(stripe.color)) { // paint previous stripe on this layer if (i == 0 && yStart[0] != ys) { drawSpot(g, stripe.thin, yStart[0], ys, stripe.color); yStart[0] = ys; } stripe.color = color; } // key changed, reinsert into queue ends.remove(stripe); stripe.yEnd = ye; ends.offer(stripe); } } return true; }); } finally { iterator.dispose(); } drawStripesEndingBefore(Integer.MAX_VALUE, thinEnds, thinStripes, g, thinYStart[0]); drawStripesEndingBefore(Integer.MAX_VALUE, wideEnds, wideStripes, g, wideYStart[0]); }