private void paintSelectionOnFirstSoftWrapLineIfNecessary(
      Graphics2D g, int columnStart, float xStart, float xEnd, int y) {
    VisualPosition selectionStartPosition =
        myEditor.getSelectionModel().getSelectionStartPosition();
    VisualPosition selectionEndPosition = myEditor.getSelectionModel().getSelectionEndPosition();
    int visualLine = myView.yToVisualLine(y);

    if (selectionStartPosition.equals(selectionEndPosition)
        || visualLine < selectionStartPosition.line
        || visualLine > selectionEndPosition.line
        || visualLine == selectionEndPosition.line && selectionEndPosition.column <= columnStart) {
      return;
    }

    float startX =
        selectionStartPosition.line == visualLine && selectionStartPosition.column > columnStart
            ? myView.visualPositionToXY(selectionStartPosition).x
            : xStart;
    float endX =
        selectionEndPosition.line == visualLine
            ? myView.visualPositionToXY(selectionEndPosition).x
            : xEnd;

    paintBackground(
        g,
        myEditor.getColorsScheme().getColor(EditorColors.SELECTION_BACKGROUND_COLOR),
        startX,
        y,
        endX - startX);
  }
 private TextAttributes getFoldRegionAttributes(FoldRegion foldRegion) {
   TextAttributes foldAttributes = myEditor.getFoldingModel().getPlaceholderAttributes();
   TextAttributes selectionAttributes =
       isSelected(foldRegion) ? myEditor.getSelectionModel().getTextAttributes() : null;
   return mergeAttributes(selectionAttributes, foldAttributes);
 }