Bug 19615 StyledText - example Text Editor bug in copy/paste
build 20020602 (F2) 1 - Run TextEditor example on org.eclipse.swt.examples 2 - aaaa on it 3 - set a style (bold, blue, red, whatever you want) for the first and the last chars. (it have to be the same style for both) 4 - Copy it and paste 5 - The style you choice will be applied on the first and on the second char of the paste string. Bug, can be on Styled Text, Drag'n Drop, or in the example itself. Tested on Windows/Motif (both show the problem). More info: if you paste the text in the Micrsoft Word it is done correctly. Likely the problem is on the StyledText when it is parsing RTF to be insert in.
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor/TextEditor.java
}
	}
}
void handleExtendedModify(ExtendedModifyEvent event) {
	if (event.length == 0) return;
	StyleRange style;
	if (event.length == 1 || text.getTextRange(event.start, event.length).equals(text.getLineDelimiter())) {
		
		
		int caretOffset = text.getCaretOffset();
		style = null;
		if (caretOffset < text.getCharCount()) style = text.getStyleRangeAtOffset(caretOffset);
		if (style != null) {
			style.start = event.start;
			style.length = event.length;
			int fontStyle = SWT.NORMAL;
			if (isBold) fontStyle = SWT.BOLD;
			style.fontStyle = fontStyle;
			text.setStyleRange(style);
		} else if (isBold) {
			StyleRange newStyle = new StyleRange(event.start, event.length, null, null, SWT.BOLD);
			text.setStyleRange(newStyle);
		}
	} else {
		
		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);