editor.getCaretModel().moveToLogicalPosition(logicalPosition);
selectionModel.removeSelection();
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
if (verticalScrollProportion != -1F)
EditorUtil.setVerticalScrollProportion(editor, verticalScrollProportion);
Document document = editor.getDocument();
if (selectionStart == selectionEnd) {
selectionModel.removeSelection();
} else {
int selectionStart = Math.min(this.selectionStart, document.getTextLength());
int selectionEnd = Math.min(this.selectionEnd, document.getTextLength());
selectionModel.setSelection(selectionStart, selectionEnd);
}
((EditorEx) editor).stopOptimizedScrolling();
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);