boolean (@NotNull Editor editor) { return ReadAction.compute(() -> { Rectangle visibleArea = editor.getScrollingModel().getVisibleArea(); Caret caret = editor.getCaretModel().getPrimaryCaret(); Point caretPoint = editor.visualPositionToXY(caret.getVisualPosition()); return visibleArea.contains(caretPoint); }); }