void (Graphics g, int startOffset, int endOffset, TextAttributes attributes, Color defaultBackgroundColor, Color defaultForegroundColor, int startX) { Color bgColor = myEditor.getBackgroundColor(attributes); if (Comparing.equal(bgColor, defaultBackgroundColor)) return; VisualPosition visualStart = myEditor.offsetToVisualPosition(startOffset, true, false); VisualPosition visualEnd = myEditor.offsetToVisualPosition(endOffset, false, false); int startVisualLine = visualStart.getLine() + (visualStart.getColumn() == 0 ? 0 : 1); int endVisualLine = visualEnd.getLine() - (visualEnd.getColumn() == 0 ? 1 : 0); if (startVisualLine <= endVisualLine) { int startY = myEditor.visualLineToY(startVisualLine); int endY = myEditor.visualLineToYRange(endVisualLine)[1]; g.setColor(bgColor); g.fillRect(startX, startY, getWidth() - startX, endY - startY); Color fgColor = attributes.getForegroundColor(); if (!Comparing.equal(fgColor, defaultForegroundColor)) { for (int line = startVisualLine; line <= endVisualLine; line++) { myTextFgColors.put(line, fgColor); } } } }