void (@NotNull Editor editor, @NotNull RangeHighlighter highlighter, @NotNull Graphics g) { int startOffset = highlighter.getStartOffset(); Document doc = highlighter.getDocument(); if (startOffset >= doc.getTextLength()) return; int endOffset = highlighter.getEndOffset(); int off; int startLine = doc.getLineNumber(startOffset); CharSequence chars = doc.getCharsSequence(); do { int start = doc.getLineStartOffset(startLine); int end = doc.getLineEndOffset(startLine); off = CharArrayUtil.shiftForward(chars, start, end, " \t"); startLine--; } while (startLine > 1 && off < doc.getTextLength() && chars.charAt(off) == '\n'); VisualPosition startPosition = editor.offsetToVisualPosition(off); VisualPosition endPosition = editor.offsetToVisualPosition(endOffset); paint(editor, startPosition, endPosition, off, endOffset, doc, g); }