void (@NotNull Rectangle viewRect, @Nullable String ref) { String refToUse; Rectangle viewRectToUse; if (DocumentationManagerProtocol.KEEP_SCROLLING_POSITION_REF.equals(ref)) { refToUse = null; viewRectToUse = myScrollPane.getViewport().getViewRect(); } else { refToUse = ref; viewRectToUse = viewRect; } updateControlState(); myLinkHandler.highlightLink(-1); myEditorPane.applyFontProps(getQuickDocFontSize()); showHint(); SwingUtilities.invokeLater(() -> { myEditorPane.scrollRectToVisible(viewRectToUse); // if ref is defined but is not found in document, this provides a default location if (refToUse != null) { UIUtil.scrollToReference(myEditorPane, refToUse); } else if (ScreenReader.isActive()) { myEditorPane.setCaretPosition(0); } }); }