private boolean hasSelection(SelectionMarker marker) {
    return marker != null && marker.isValid() && (marker.getEndOffset() > marker.getStartOffset()
                                                  || isVirtualSelectionEnabled() && marker.hasVirtualSelection());
  }
private boolean hasSelection(SelectionMarker marker)