public void CopyData(TextEditorData data)
{
Selection selection;
isLineSelectionMode = !data.IsSomethingSelected;
if (data.IsSomethingSelected)
{
selection = data.MainSelection;
}
else
{
var start = DeleteActions.GetStartOfLineOffset(data, data.Caret.Location);
var end = DeleteActions.GetEndOfLineOffset(data, data.Caret.Location, false);
selection = new Selection(data.OffsetToLocation(start), data.OffsetToLocation(end));
}
CopyData(data, selection);
if (Copy != null)
{
Copy(copiedDocument != null ? copiedDocument.Text : null);
}
}