void (@NotNull MouseEvent e) { if (checkIgnore(e, true)) return; if (e.getSource() == myGutterComponent && !(myMousePressedEvent != null && myMousePressedEvent.isConsumed())) { myGutterComponent.mouseReleased(e); } if (getMouseEventArea(e) != EditorMouseEventArea.EDITING_AREA || e.getY() < 0 || e.getX() < 0) { return; } // if (myMousePressedInsideSelection) getSelectionModel().removeSelection(); final FoldRegion region = getFoldingModel().getFoldingPlaceholderAt(e.getPoint()); if (e.getX() >= 0 && e.getY() >= 0 && region != null && region == myMouseSelectedRegion) { getFoldingModel().runBatchFoldingOperation(new Runnable() { @Override public void run() { myFoldingModel.flushCaretShift(); region.setExpanded(true); } }); // The call below is performed because gutter's height is not updated sometimes, i.e. it sticks to the value that corresponds // to the situation when fold region is collapsed. That causes bottom of the gutter to not be repainted and that looks really ugly. myGutterComponent.updateSize(); } // The general idea is to check if the user performed 'caret position change click' (left click most of the time) inside selection // and, in the case of the positive answer, clear selection. Please note that there is a possible case that mouse click // is performed inside selection but it triggers context menu. We don't want to drop the selection then. if (myMousePressedEvent != null && myMousePressedEvent.getClickCount() == 1 && myMousePressedInsideSelection && !myMousePressedEvent.isShiftDown() && !myMousePressedEvent.isPopupTrigger() && !isToggleCaretEvent(myMousePressedEvent) && !isCreateRectangularSelectionEvent(myMousePressedEvent)) { getSelectionModel().removeSelection(); } }