setCaretLocation();
void updateSelection(int startOffset, int replacedLength, int newLength) {	if (selection.y <= startOffset) {		// selection ends before text change		return;	}	if (selection.x < startOffset) {		// clear selection fragment before text change		internalRedrawRange(selection.x, startOffset - selection.x, true);	}	if (selection.y > startOffset + replacedLength && selection.x < startOffset + replacedLength) {		// clear selection fragment after text change.		// do this only when the selection is actually affected by the 		// change. Selection is only affected if it intersects the change (1GDY217).		int netNewLength = newLength - replacedLength;		int redrawStart = startOffset + newLength;		internalRedrawRange(redrawStart, selection.y + netNewLength - redrawStart, true);	}	if (selection.y > startOffset && selection.x < startOffset + replacedLength) {		// selection intersects replaced text. set caret behind text change		internalSetSelection(startOffset + newLength, 0, true);		// always update the caret location. fixes 1G8FODP		setCaretLocation();	} else {		// move selection to keep same text selected		internalSetSelection(selection.x + newLength - replacedLength, selection.y - selection.x, true);		// always update the caret location. fixes 1G8FODP		setCaretLocation();	}}