LogicalPosition getSelectionEndLogicalPosition() {
    ThreadingAssertions.assertEventDispatchThread();
    LogicalPosition position;
    SelectionMarker marker = mySelectionMarker;
    if (hasSelection()) {
      VisualPosition visualPosition = getRangeMarkerEndPosition();
      position = visualPosition == null ? myEditor.offsetToLogicalPosition(marker.getEndOffset())
                                        : myEditor.visualToLogicalPosition(visualPosition);
    }
    else {
      position = getLogicalPosition();
    }
    if (hasVirtualSelection()) {
      position = new LogicalPosition(position.line, position.column + marker.endVirtualOffset);
    }
    return position;
  }
LogicalPosition getSelectionEndLogicalPosition()