void handleExtendedModify(ExtendedModifyEvent event) {
	if (event.length == 0) return;
	StyleRange style;
	if (event.length == 1 || text.getTextRange(event.start, event.length).equals(text.getLineDelimiter())) {
		// Have the new text take on the style of the text to its right (during
		// typing) if no style information is active.
		int caretOffset = text.getCaretOffset();
		style = null;
		if (caretOffset < text.getCharCount()) style = text.getStyleRangeAtOffset(caretOffset);
		if (style != null) {
			style = (StyleRange) style.clone ();
			style.start = event.start;
			style.length = event.length;
		} else {
			style = new StyleRange(event.start, event.length, null, null, SWT.NORMAL);
		}		
		if (boldButton.getSelection()) style.fontStyle |= SWT.BOLD;
		if (italicButton.getSelection()) style.fontStyle |= SWT.ITALIC;
		style.underline = underlineButton.getSelection();
		style.strikeout = strikeoutButton.getSelection();
		if (!style.isUnstyled()) text.setStyleRange(style);
	} else {
		// paste occurring, have text take on the styles it had when it was
		// cut/copied
		for (int i=0; i<cachedStyles.size(); i++) {
			style = (StyleRange)cachedStyles.elementAt(i);
			StyleRange newStyle = (StyleRange)style.clone();
			newStyle.start = style.start + event.start;
			text.setStyleRange(newStyle);
		}
	}
}