protected void paintSelection(Graphics g, FieldBackgroundColorManager colorManager,
			int rowHeight) {
		List<Highlight> selections = colorManager.getSelectionHighlights(0);
		if (selections.isEmpty()) {
			return;
		}

		Color leftMarginColor = colorManager.getPaddingColor(0);

		if (leftMarginColor != null) {
			g.setColor(leftMarginColor);
			g.fillRect(startX, -getHeightAbove(), textStartX - startX, rowHeight);
		}
		for (Highlight highlight : selections) {
			g.setColor(highlight.getColor());
			int startCol = highlight.getStart();
			int endCol = highlight.getEnd();
			int x1 = findX(startCol);
			int x2 = endCol > getString().length() ? width - (textStartX - startX) : findX(endCol);
			g.fillRect(textStartX + x1, -getHeightAbove(), x2 - x1, getHeight());
		}
	}
Checks if any of the textElements need to be clipped. If so, it creates a
new textElement for the element that needs to be clipped that will fit in
the available space. Any textElements past the clipped element will be
ignored.
Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/field/ReverseClippingTextField.java