void (int startOffset, @Nullable VisualPosition endPosition, int endOffset) { VisualPosition startPosition; if (hasSelection()) { startPosition = getLeadSelectionPosition(); } else { startPosition = myEditor.offsetToVisualPosition(startOffset, true, false); } setSelection(startPosition, startOffset, endPosition, endOffset); }