CaretLineState (@NotNull Caret caret) { Editor editor = caret.getEditor(); int lineStartOffset = EditorUtil.getNotFoldedLineStartOffset(editor, caret.getOffset()); VisualPosition lineStartPosition = editor.offsetToVisualPosition(lineStartOffset); return new CaretLineState(caret, caret.getVisualPosition(), lineStartOffset, lineStartPosition); }