newEdit= new ReplaceEdit(edit.getOffset() - diff, edit.getLength(), edit.getText());
} else if (oldEdit instanceof InsertEdit) {
InsertEdit edit= (InsertEdit) oldEdit;
newEdit= new InsertEdit(edit.getOffset() - diff, edit.getText());
} else if (oldEdit instanceof DeleteEdit) {
DeleteEdit edit= (DeleteEdit) oldEdit;
newEdit= new DeleteEdit(edit.getOffset() - diff, edit.getLength());
} else if (oldEdit instanceof MultiTextEdit) {
newEdit= new MultiTextEdit();
} else {
return null; // not supported
}