// undo after paste in document with folds - wrong behavior
IRegion widgetSelection = new Region(cursorPosition, selectionLength);
IRegion documentSelection = widgetRange2ModelRange(widgetSelection);
if (documentSelection == null)
documentSelection = widgetSelection;
undoManager.beginRecording(this, label, description, documentSelection.getOffset(), documentSelection.getLength());
}
else {
// TODO: how to handle other document types?
}
}