void (@NotNull Graphics g, @NotNull Point position, @NotNull Rectangle clip, @NotNull Color defaultBackground, @JdkConstants.FontStyle int fontType, @NotNull SoftWrap softWrap) { // There is a possible case that the user performed selection at soft wrap virtual space. We need to paint corresponding background // there then. VisualPosition selectionStartPosition = getSelectionStartPositionForPaint(); VisualPosition selectionEndPosition = getSelectionEndPositionForPaint(); if (selectionStartPosition.equals(selectionEndPosition)) { return; } int currentVisualLine = position.y / getLineHeight(); // Check if the second soft wrap line is within the visual selection. if (currentVisualLine < selectionStartPosition.line || currentVisualLine > selectionEndPosition.line || currentVisualLine == selectionStartPosition.line && selectionStartPosition.column >= softWrap.getIndentInColumns()) { return; } // Adjust 'x' if selection starts at soft wrap virtual space. if (selectionStartPosition.line == currentVisualLine && selectionStartPosition.column > 0) { position.x += selectionStartPosition.column * EditorUtil.getSpaceWidth(fontType, this); } // Calculate selection width. final int width; if (selectionEndPosition.line > currentVisualLine || selectionEndPosition.column >= softWrap.getIndentInColumns()) { width = softWrap.getIndentInPixels() - position.x; } else { width = selectionEndPosition.column * EditorUtil.getSpaceWidth(fontType, this) - position.x; } drawBackground(g, getColorsScheme().getColor(EditorColors.SELECTION_BACKGROUND_COLOR), width, position, defaultBackground, clip); }