private void TransformSelectedLines(Action<IDocumentLine> transformLine)
{
var selection = GetSelectionAsSegment();
var lines = VisualLineGeometryBuilder.GetLinesForSegmentInDocument(TextDocument, selection);
if (lines.Count() > 0)
{
var anchors = new TextSegmentCollection<TextSegment>(TextDocument);
anchors.Add(selection);
// TODO Add an achor to the caret index...
TextDocument.BeginUpdate();
foreach (var line in lines)
{
transformLine(line);
}
TextDocument.EndUpdate();
SetSelection(selection);
}
}