LayoutFarm.Text.InternalTextLayerController.DoDelete C# (CSharp) Method

DoDelete() public method

public DoDelete ( ) : VisualSelectionRangeSnapShot
return VisualSelectionRangeSnapShot
        public VisualSelectionRangeSnapShot DoDelete()
        {
            //recursive
#if DEBUG
            if (dbugEnableTextManRecorder)
            {
                dbugTextManRecorder.WriteInfo("TxLMan::DoDelete");
                dbugTextManRecorder.BeginContext();
            }
#endif

            VisualSelectionRangeSnapShot removedRange = this.RemoveSelectedText();
            if (removedRange.IsEmpty())
            {
                updateJustCurrentLine = true;
                char deletedChar = textLineWriter.DoDelete();
                //some language

                if (deletedChar == '\0')
                {
                    commandHistory.AddDocAction(
                        new DocActionJoinWithNextLine(
                            textLineWriter.LineNumber, textLineWriter.CharIndex));
                    JoinWithNextLine();
                    updateJustCurrentLine = false;
                }
                else
                {
                    commandHistory.AddDocAction(
                        new DocActionDeleteChar(
                            deletedChar, textLineWriter.LineNumber, textLineWriter.CharIndex));
                    char nextChar = textLineWriter.NextChar;
                    if (nextChar != '\0' && textLineWriter.NextCharWidth < 1)
                    {
                        //recursive
                        DoDelete();
                    }
                }
            }
#if DEBUG
            if (dbugEnableTextManRecorder) dbugTextManRecorder.EndContext();
#endif

            return removedRange;
        }
#if DEBUG

Usage Example

コード例 #1
0
 public override void InvokeUndo(InternalTextLayerController textdom)
 {
     textdom.CurrentLineNumber = startLineNumber;
     textdom.CharIndex         = startCharIndex;
     textdom.StartSelect();
     textdom.CurrentLineNumber = endLineNumber;
     textdom.CharIndex         = endCharIndex;
     textdom.EndSelect();
     textdom.DoDelete();
 }
All Usage Examples Of LayoutFarm.Text.InternalTextLayerController::DoDelete