void (@NotNull Caret caret, int offset, boolean withSelection) { if (withSelection) { caret.setSelection(caret.getLeadSelectionOffset(), offset); } else { caret.removeSelection(); } caret.moveToOffset(offset); EditorModificationUtilEx.scrollToCaret(caret.getEditor()); }