void (@NotNull MouseEvent e) { RangeHighlighter marker = getNearestRangeHighlighter(e); int offset; LogicalPosition logicalPositionToScroll = null; LightweightHint editorPreviewHint = myEditorFragmentRenderer.getEditorPreviewHint(); if (marker == null) { if (editorPreviewHint != null) { logicalPositionToScroll = myEditor.visualToLogicalPosition(new VisualPosition(myEditorFragmentRenderer.getStartVisualLine(), 0)); offset = myEditor.getDocument().getLineStartOffset(logicalPositionToScroll.line); } else { return; } } else { offset = marker.getStartOffset(); } Document doc = myEditor.getDocument(); if (doc.getLineCount() > 0 && editorPreviewHint == null) { // Necessary to expand folded block even if navigating just before one // Very useful when navigating to the first unused import statement. int lineEnd = doc.getLineEndOffset(doc.getLineNumber(offset)); myEditor.getCaretModel().moveToOffset(lineEnd); } myEditor.getCaretModel().removeSecondaryCarets(); myEditor.getCaretModel().moveToOffset(offset); myEditor.getSelectionModel().removeSelection(); ScrollingModel scrollingModel = myEditor.getScrollingModel(); scrollingModel.disableAnimation(); if (logicalPositionToScroll != null) { int lineY = myEditor.logicalPositionToXY(logicalPositionToScroll).y; int relativePopupOffset = myEditorFragmentRenderer.getRelativeY(); scrollingModel.scrollVertically(lineY - relativePopupOffset); } else { scrollingModel.scrollToCaret(ScrollType.CENTER); } scrollingModel.enableAnimation(); if (marker != null) { myErrorStripeMarkersModel.fireErrorMarkerClicked(marker, e); } }