boolean (@NotNull FoldRegion region) { int regionStartLine = myEditor.getDocument().getLineNumber(region.getStartOffset()); int regionEndLine = myEditor.getDocument().getLineNumber(region.getEndOffset()); int caretLine = myEditor.getCaretModel().getLogicalPosition().line; return caretLine >= regionStartLine && caretLine <= regionEndLine; }