@Override
	public ListingField getField(ProxyObj<?> proxy, int varWidth) {
		if (!enabled || !(proxy.getObject() instanceof CodeUnit cu)) {
			return null;
		}

		// Instructions: use prototype length so we display all bytes for length-override case
		// Consider all parsed bytes even if the overlap the next instruction due to the
		// use of an instruction length-override.
		final int arrLength =
			cu instanceof Instruction ins ? ins.getParsedLength() : Math.min(cu.getLength(), 100);

		byte[] bytes = new byte[arrLength];
		final int length = cu.getBytes(bytes, 0);

		if (length == 0) {
			return null;
		}

		if ((cu instanceof Instruction) && reverseInstByteOrdering && !cu.isBigEndian()) {
			ArrayUtils.reverse(bytes);
		}

		int groupLength = length / byteGroupSize;
		int residual = length % byteGroupSize;
		if (residual != 0) {
			groupLength++;
		}

		boolean wasTruncated = length != cu.getLength();
		byte[] alignmentBytes = getAlignmentBytes(cu, wasTruncated);
		int extraLength = getLengthForAlignmentBytes(alignmentBytes, residual);
		FieldElement[] elements = new FieldElement[groupLength + extraLength];
		boolean addDelimiter = extraLength != 0;
		buildAttributedByteValues(elements, 0, bytes, length, 0, ListingColors.BYTES, addDelimiter);
		if (addDelimiter) {
			buildAttributedByteValues(elements, groupLength, alignmentBytes, alignmentBytes.length,
				residual, ListingColors.BYTES_ALIGNMENT, false);
		}

		return ListingTextField.createPackedTextField(this, proxy, elements, startX + varWidth,
			width, maxDisplayLines, hlProvider);
	}
Constructor
@param model the model that the field belongs to.
@param hlProvider the HightLightStringProvider.
@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/BytesFieldFactory.java