private @NotNull TextAttributes getBetweenLinesAttributes(int bottomVisualLine,
                                                              int bottomVisualLineStartOffset,
                                                              PeekableIterator<? extends Caret> caretIterator) {
      boolean selection = false;
      while (caretIterator.hasNext() && caretIterator.peek().getSelectionEnd() < bottomVisualLineStartOffset) caretIterator.next();
      if (caretIterator.hasNext()) {
        Caret caret = caretIterator.peek();
        selection = caret.getSelectionStart() <= bottomVisualLineStartOffset &&
                    caret.getSelectionStartPosition().line < bottomVisualLine && bottomVisualLine <= caret.getSelectionEndPosition().line;
      }

      final class MyProcessor implements Processor<RangeHighlighterEx> {
        private int layer;
        private Color backgroundColor;

        private MyProcessor(boolean selection) {
          backgroundColor = selection ? myEditor.getSelectionModel().getTextAttributes().getBackgroundColor() : null;
          layer = backgroundColor == null ? Integer.MIN_VALUE : HighlighterLayer.SELECTION;
        }

        @Override
        public boolean process(RangeHighlighterEx highlighterEx) {
          int layer = highlighterEx.getLayer();
          if (layer > this.layer &&
              highlighterEx.getAffectedAreaStartOffset() < bottomVisualLineStartOffset &&
              highlighterEx.getAffectedAreaEndOffset() > bottomVisualLineStartOffset -
                                                         (highlighterEx.getTargetArea() == HighlighterTargetArea.EXACT_RANGE ? 0 : 1)) {
            TextAttributes attributes = highlighterEx.getTextAttributes(myEditor.getColorsScheme());
            Color backgroundColor = attributes == null ? null : attributes.getBackgroundColor();
            if (backgroundColor != null) {
              this.layer = layer;
              this.backgroundColor = backgroundColor;
            }
          }
          return true;
        }
      }
      MyProcessor processor = new MyProcessor(selection);
      myDocMarkup.processRangeHighlightersOverlappingWith(bottomVisualLineStartOffset, bottomVisualLineStartOffset, processor);
      myEditorMarkup.processRangeHighlightersOverlappingWith(bottomVisualLineStartOffset, bottomVisualLineStartOffset, processor);
      TextAttributes attributes = new TextAttributes();
      attributes.setBackgroundColor(processor.backgroundColor);
      return attributes;
    }
private @NotNull TextAttributes getBetweenLinesAttributes(int bottomVisualLine,
                                                              int bottomVisualLineStartOffset,
                                                              PeekableIterator<? extends Caret> caretIterator)