private ListingField getFieldByAddress(ProxyObj<?> proxy, int varWidth, List<Reference> xrefs,
			List<Reference> offcuts) {

		int totalXrefs = xrefs.size() + offcuts.size();
		if (totalXrefs == 0) {
			return null;
		}

		Object obj = proxy.getObject();
		CodeUnit cu = (CodeUnit) obj;
		Program program = cu.getProgram();
		FontMetrics metrics = getMetrics();
		AttributedString delimiter = new AttributedString(delim, Colors.FOREGROUND, metrics);

		Set<Reference> offcutSet = new HashSet<>(offcuts);
		Predicate<Reference> isOffcut = r -> offcutSet.contains(r);

		boolean tooMany = totalXrefs > maxXRefs;
		List<XrefFieldElement> elements = new ArrayList<>();
		FunctionManager functionManager = program.getFunctionManager();
		Function currentFunction = functionManager.getFunctionContaining(cu.getMinAddress());
		int n = tooMany ? maxXRefs : totalXrefs;
		int count = 0;
		for (; count < xrefs.size() && count < n; count++) {
			Reference ref = xrefs.get(count);
			String prefix = getPrefix(program, ref, currentFunction);
			elements.add(
				createReferenceElement(program, prefix, ref, count, delimiter, isOffcut.test(ref)));
		}

		for (int i = 0; i < offcuts.size() && count < n; i++, count++) {
			Reference ref = offcuts.get(i);
			String prefix = getPrefix(program, ref, currentFunction);
			elements.add(
				createReferenceElement(program, prefix, ref, count, delimiter, isOffcut.test(ref)));
		}

		if (!tooMany) {
			XrefFieldElement lastElement = elements.get(elements.size() - 1);
			lastElement.hideDelimiter();
		}

		List<FieldElement> fieldElements = toFieldElements(elements, tooMany);
		return createPackedTextField(proxy, varWidth, fieldElements);
	}
Constructs a new XRefFieldFactory based on the provider and model.

@param name the owner of this field factory
@param model the model that the field belongs to.
@param hlProvider the HightLightProvider.
@param displayOptions the Options for display properties.
@param fieldOptions the Options for field specific properties.
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/XRefFieldFactory.java