int () { Editor editor = myItem.getEditor(); RangeHighlighter highlighter = myItem.getHighlighter(); if (highlighter.isValid()) { Document document = editor.getDocument(); int nextLineNumber = document.getLineNumber(highlighter.getEndOffset()) + 1; if (nextLineNumber < document.getLineCount()) { int lineStartOffset = document.getLineStartOffset(nextLineNumber); int contentStartOffset = CharArrayUtil.shiftForward(document.getImmutableCharSequence(), lineStartOffset, " \t\n"); return editor.offsetToXY(contentStartOffset, false, true).x; } } return editor.getInsets().left; }