VisualSelectionRangeSnapShot RemoveSelectedText()
{
#if DEBUG
if (dbugEnableTextManRecorder)
{
dbugTextManRecorder.WriteInfo("TxLMan::RemoveSelectedText");
dbugTextManRecorder.BeginContext();
}
#endif
if (selectionRange == null)
{
#if DEBUG
if (dbugEnableTextManRecorder)
{
dbugTextManRecorder.WriteInfo("NO_SEL_RANGE");
dbugTextManRecorder.EndContext();
}
#endif
return VisualSelectionRangeSnapShot.Empty;
}
else if (!selectionRange.IsValid)
{
#if DEBUG
if (dbugEnableTextManRecorder)
{
dbugTextManRecorder.WriteInfo("!RANGE_ON_SAME_POINT");
}
#endif
CancelSelect();
#if DEBUG
if (dbugEnableTextManRecorder)
{
dbugTextManRecorder.EndContext();
}
#endif
return VisualSelectionRangeSnapShot.Empty;
}
selectionRange.SwapIfUnOrder();
VisualSelectionRangeSnapShot selSnapshot = selectionRange.GetSelectionRangeSnapshot();
VisualPointInfo startPoint = selectionRange.StartPoint;
CurrentLineNumber = startPoint.LineId;
int preCutIndex = startPoint.LineCharIndex;
textLineWriter.CharIndex = startPoint.LineCharIndex;
if (selectionRange.IsOnTheSameLine)
{
LinkedList<EditableRun> tobeDeleteTextRun = textLineWriter.CopySelectedTextRuns(selectionRange);
if (tobeDeleteTextRun != null)
{
commandHistory.AddDocAction(
new DocActionDeleteRange(tobeDeleteTextRun,
selSnapshot.startLineNum,
selSnapshot.startColumnNum,
selSnapshot.endLineNum,
selSnapshot.endColumnNum));
textLineWriter.RemoveSelectedTextRuns(selectionRange);
updateJustCurrentLine = true;
}
}
else
{
int startPointLindId = startPoint.LineId;
int startPointCharIndex = startPoint.LineCharIndex;
LinkedList<EditableRun> tobeDeleteTextRun = textLineWriter.CopySelectedTextRuns(selectionRange);
if (tobeDeleteTextRun != null)
{
commandHistory.AddDocAction(
new DocActionDeleteRange(tobeDeleteTextRun,
selSnapshot.startLineNum,
selSnapshot.startColumnNum,
selSnapshot.endLineNum,
selSnapshot.endColumnNum));
textLineWriter.RemoveSelectedTextRuns(selectionRange);
updateJustCurrentLine = false;
textLineWriter.MoveToLine(startPointLindId);
textLineWriter.CharIndex = startPointCharIndex;
}
}
CancelSelect();
TextEditRenderBox.NotifyTextContentSizeChanged(visualTextSurface);
#if DEBUG
if (dbugEnableTextManRecorder)
{
dbugTextManRecorder.EndContext();
}
#endif
return selSnapshot;
}
void SplitSelectedText()