if (drawDirect) { int startLine = content.getLineAtOffset(event.start); int startY = startLine * lineHeight - verticalScrollOffset; GC gc = new GC(this); performPaint(gc, startLine, startY, lineHeight); drawDirect = false; gc.dispose(); }
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;		boolean isBackspace = event.start < caretOffset;		boolean isDirectionBoundary = false;				if (updateCaret && isBidi()) {			int line = content.getLineAtOffset(caretOffset);			int lineStartOffset = content.getOffsetAtLine(line);					int offsetInLine = caretOffset - lineStartOffset;			String lineText = content.getLine(line);			GC gc = new GC(this);			StyledTextBidi bidi = new StyledTextBidi(gc, lineText, getBidiSegments(lineStartOffset, lineText));						isDirectionBoundary = (offsetInLine > 0 && bidi.isRightToLeft(offsetInLine) != bidi.isRightToLeft(offsetInLine - 1));			gc.dispose();		}								if (isListening(ExtendedModify)) {			styledTextEvent = new StyledTextEvent(logicalContent);			styledTextEvent.start = event.start;			styledTextEvent.end = event.start + event.text.length();			styledTextEvent.text = content.getTextRange(event.start, replacedLength);		}		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			internalSetSelection(event.start + event.text.length(), 0, true);			if (isBidi()) {				// Update the caret direction so that the caret moves to the 				// typed/deleted character. Fixes 1GJLQ16.				if (replacedLength == 1 && event.text.length() == 0) {					updateBidiDirection(isBackspace, isDirectionBoundary);				}				else {					lastCaretDirection = ST.COLUMN_NEXT;				}				showBidiCaret();			}			else {				showCaret();			}		}				notifyListeners(SWT.Modify, event);				if (isListening(ExtendedModify)) {			notifyListeners(ExtendedModify, styledTextEvent);		}	}}