public SnapshotPoint?GetBufferPositionFromXCoordinate(double xCoordinate, bool textOnly) { var y = textEditor.LocationToPoint(textEditor.OffsetToLocation(lineSpan.Start)).Y; var loc = textEditor.PointToLocation(xCoordinate, y); var pos = textEditor.LocationToOffset(loc); return(new SnapshotPoint(Snapshot, pos)); }