Cursor (@NotNull MouseEvent e, @Nullable EditorMouseEvent editorMouseEvent) { Cursor result = null; if (getSelectionModel().hasSelection() && (e.getModifiersEx() & (InputEvent.BUTTON1_DOWN_MASK | InputEvent.BUTTON2_DOWN_MASK)) == 0) { int offset = editorMouseEvent == null ? logicalPositionToOffset(xyToLogicalPosition(e.getPoint())) : editorMouseEvent.getOffset(); if (getSelectionModel().getSelectionStart() <= offset && offset < getSelectionModel().getSelectionEnd()) { result = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); } } if (result == null) { FoldRegion foldRegion = editorMouseEvent == null ? myFoldingModel.getFoldingPlaceholderAt(e.getPoint()) : editorMouseEvent.getCollapsedFoldRegion(); if (foldRegion != null && !(foldRegion instanceof CustomFoldRegion)) { result = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); } } return result == null ? NamedColorUtil.getTextCursor(getBackgroundColor()) : result; }