public static List<String> split(String text, int maxLineLength, boolean retainSpacing) {

		List<String> lines = new ArrayList<>();
		int limit = -1;
		String[] newlines = text.split("\n", limit);
		if (maxLineLength <= 0) {
			// no wrapping to length needed
			lines.addAll(Arrays.asList(newlines));
			return lines;
		}

		WhitespaceHandler counter =
			retainSpacing ? new PreservingWhitespaceHandler() : new TrimmingWhitespaceHandler();

		for (String line : newlines) {
			if (line.length() == 0) {
				// this was a newline character
				lines.add(line);
				continue;
			}

			List<String> subLines = wrap(line, maxLineLength, counter);
			lines.addAll(subLines);
		}

		return lines;
	}
Splits the given line into multiple lines based upon the given max length.  This method
will first split on each newline and then wrap each of the lines returned from that split.

<P>The wrapping routine will attempt to wrap at word boundaries.

@param text the text to wrap
@param maxLineLength the max desired length of each output line; 0 or less signals not
       to wrap the line based upon length
@param retainSpacing true signals to keep whitespace on line breaks; false discards 
       leading whitespace
@return the new lines
@see #wrap(String, int, WhitespaceHandler)
Ghidra/Framework/Gui/src/main/java/ghidra/util/html/HtmlLineSplitter.java