advancing = levelStart != levelEnd;
if (levelStart != levelEnd) { caretAlignment = PREVIOUS_OFFSET_TRAILING; } else { caretAlignment = OFFSET_LEADING; }
void modifyContent(Event event, boolean updateCaret) {	event.doit = true;	notifyListeners(SWT.Verify, event);	if (event.doit) {		StyledTextEvent styledTextEvent = null;		int replacedLength = event.end - event.start;		if (isListening(ExtendedModify)) {			styledTextEvent = new StyledTextEvent(content);			styledTextEvent.start = event.start;			styledTextEvent.end = event.start + event.text.length();			styledTextEvent.text = content.getTextRange(event.start, replacedLength);		}		if (updateCaret) {			//Fix advancing flag for delete/backspace key on direction boundary			if (event.text.length() == 0) {				int lineIndex = content.getLineAtOffset(event.start);				int lineOffset = content.getOffsetAtLine(lineIndex);				TextLayout layout = renderer.getTextLayout(lineIndex);				int levelStart = layout.getLevel(event.start - lineOffset);				int lineIndexEnd = content.getLineAtOffset(event.end);				if (lineIndex != lineIndexEnd) {					renderer.disposeTextLayout(layout);					lineOffset = content.getOffsetAtLine(lineIndexEnd);					layout = renderer.getTextLayout(lineIndexEnd);				}				int levelEnd = layout.getLevel(event.end - lineOffset);				renderer.disposeTextLayout(layout);				advancing = levelStart != levelEnd;			}		}		content.replaceTextRange(event.start, replacedLength, event.text);		// set the caret position prior to sending the modify event.		// fixes 1GBB8NJ		if (updateCaret) {			// always update the caret location. fixes 1G8FODP			setSelection(event.start + event.text.length(), 0, true);			showCaret();		}		sendModifyEvent(event);		if (isListening(ExtendedModify)) {			notifyListeners(ExtendedModify, styledTextEvent);		}	}}