void (@NotNull Graphics g, @NotNull SoftWrap softWrap, @NotNull Point position, @JdkConstants.FontStyle int fontType, @Nullable Color backColor, boolean drawCustomBackgroundAtSoftWrapVirtualSpace, @NotNull Color defaultBackground, @NotNull Rectangle clip, @NotNull boolean[] caretRowPainted) { // The main idea is to to do the following: // *) update given drawing position coordinates in accordance with the current soft wrap; // *) draw background at soft wrap-introduced virtual space if necessary; CharSequence softWrapText = softWrap.getText(); int activeRowY = getCaretModel().getVisualPosition().line * getLineHeight(); int afterSoftWrapWidth = clip.x + clip.width - position.x; if (drawCustomBackgroundAtSoftWrapVirtualSpace && backColor != null) { drawBackground(g, backColor, afterSoftWrapWidth, position, defaultBackground, clip); } else if (position.y == activeRowY) { // Draw 'active line' background after soft wrap. Color caretRowColor = mySettings.isCaretRowShown()? getColorsScheme().getColor(EditorColors.CARET_ROW_COLOR) : null; drawBackground(g, caretRowColor, afterSoftWrapWidth, position, defaultBackground, clip); caretRowPainted[0] = true; } paintSelectionOnFirstSoftWrapLineIfNecessary(g, position, clip, defaultBackground, fontType); int i = CharArrayUtil.lastIndexOf(softWrapText, "\n", softWrapText.length()) + 1; int width = getTextSegmentWidth(softWrapText, i, softWrapText.length(), 0, fontType, clip) + getSoftWrapModel().getMinDrawingWidthInPixels(SoftWrapDrawingType.AFTER_SOFT_WRAP); position.x = 0; position.y += getLineHeight(); if (drawCustomBackgroundAtSoftWrapVirtualSpace && backColor != null) { drawBackground(g, backColor, width, position, defaultBackground, clip); } else if (position.y == activeRowY) { // Draw 'active line' background for the soft wrap-introduced virtual space. Color caretRowColor = mySettings.isCaretRowShown()? getColorsScheme().getColor(EditorColors.CARET_ROW_COLOR) : null; drawBackground(g, caretRowColor, width, position, defaultBackground, clip); } position.x = 0; paintSelectionOnSecondSoftWrapLineIfNecessary(g, position, clip, defaultBackground, fontType, softWrap); position.x = width; }