public static List<FieldElement> wrap(FieldElement fieldElement, int width) {
		List<FieldElement> lines = new ArrayList<>();
		if (fieldElement.getStringWidth() <= width) {
			lines.add(fieldElement);
			return lines;
		}

		FieldElement element = fieldElement;
		int wordWrapPos = findWordWrapPosition(element, width);
		while (wordWrapPos > 0) {
			lines.add(element.substring(0, wordWrapPos));
			element = element.substring(wordWrapPos);
			wordWrapPos = findWordWrapPosition(element, width);
		}
		lines.add(element);
		return lines;
	}
Splits the given FieldElement into sub-elements by wrapping the element on whitespace.

@param fieldElement The element to wrap
@param width The maximum width to allow before wrapping
@return The wrapped elements
Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/support/FieldUtils.java